csvをxmlに変換するスクリプトからこれを取得しています
構文エラー 無効な構文
print(text, file=self.file, end=self.args.linebreak)
ポイントは最初の「=」の下にあります。これがなぜなのかわかりません。誰かが正しい方向を指すことができますか.
ありがとうアロンゾ
class Writer:
def __init__(self, ofile, args):
self.file = ofile
self.args = args
self.newline_subst = field_subst_factory(args.newline_elem)
if args.header:
self.fieldname = self.__fieldname_header
elif args.flat_fields:
self.fieldname = self.__fieldname_flat
else:
self.fieldname = self.__fieldname_indexed
def write_file(self, data):
if self.args.declaration:
declaration = ('<?xml version="1.0" encoding="{0}"?>'.
format(args.oencoding))
self.write(declaration)
self.write("<{0}>".format(self.args.root_elem))
for record in data:
self.write_record(record)
self.write("<\{0}>".format(self.args.root_elem))
def write_record(self, record):
self.write("{0}<{1}>".
format(self.args.indent, self.args.record_elem))
for index, field in enumerate(record):
self.write_field(field, index)
self.write("{0}<\{1}>".
format(self.args.indent, self.args.record_elem))
def write_field(self, field, index):
self.write("{0}{0}<{1}>{2}</{1}>".
format(self.args.indent, self.fieldname(index),
self.newline_subst(field)))
def write(self, text):
**print(text, file=self.file, end=self.args.linebreak)** This the line that's causing issues
def __fieldname_header(self, index):
return self.args.header[index]
def __fieldname_flat(self, index):
return self.args.field_elem
def __fieldname_indexed(self, index):
return self.args.field_elem + str(index)