私はPythonを始めたばかりなので、おそらく何か愚かなことをしているだけです。テーブルからデータを読み取っていて、それらを txt ファイルの列に入れる必要があります。コードに新しい行を作成するよう説得できません。
これが私のコードです-
file = open("test_m.rdb")
table = open('table.txt', 'w+')
trash = file.readline()
trash = file.readline()
data = file.readline()
i = data.split()
flux = i[2]
observed = i[4]
table.write(flux + " " + observed,)
while 1:
line = file.readline()
i = line.split()
try:
flux = i[2]
observed = i[4]
except IndexError:
break
table.write(\nflux + " " + observed)
table.close()
そして、エラーの読み取り-
File "PlotRdbFile.py", line 24
table.write(\nflux + " " + observed)
^
SyntaxError: unexpected character after line continuation character
私の間違いを見つけてくれてありがとう。