毎週の授業計画のために、リストとして保存するシラバスからデータを取得したいラテックス テーブルがあります。 4 年生は週に 3 回、6 年生は週に 3 回、最初のレッスンをむさぼり食って、最初のトークンに固執し、次の . . . 今、私のコードは、ch1、ch2、ch3 ではなく、月曜、水曜、金曜にチャプター 1 を与えるだけです。
math6 = ['chapter1', 'chapter2', 'chapter3', 'chapter1-3test']
math4= ['chapter1.1', 'chapter1.2-3', 'chapter2']
\begin{tabular}{|p{0.7in}|p{0.8in}|p{2.2in}|p{.9in}|p{2.6in}|p{1.6in}|}
6${}^{th}$ Math \newline M\newline & _math6_&
6${}^{th}$ Math \newline W \newline & _math6_ &
6${}^{th}$ Math \newline F \newline & _math6_ &
4${}^{th}$ Math \newline M\newline & & _math4_ &
4${}^{th}$ Math \newline W\newline & & _math4_ &
\end{tabular}
ここにパイソンがあります
import re
template = file('file1.txt', 'r').read()
lost= ["geography", "physics", "hairdressing", "torah"]
n =0
while n<len(lost):
temp=lost[n]
page= re.sub(r'_thing_', temp, template)
print page
n+=1
#page= re.sub(r'_thing_', "martha", template)
#file('result.txt', 'w').write(page)
それは私に与えます
#contents of file1
# Really long Latex
#File that has
# geography, geography, mary, tom, susan, geography
#that I want to replace
#read file1 in as a string, replace, save again
#contents of file1
# Really long Latex
#File that has
# physics, physics, mary, tom, susan, physics
#that I want to replace
#read file1 in as a string, replace, save again
#contents of file1
# Really long Latex
#File that has
# hairdressing, hairdressing, mary, tom, susan, hairdressing
#that I want to replace
#read file1 in as a string, replace, save again
#contents of file1
# Really long Latex
#File that has
# torah, torah, mary, tom, susan, torah
#that I want to replace
#read file1 in as a string, replace, save again