0

何がこの構文エラーを引き起こしているのか疑問に思っています:

  File "/Users/samuelfinegold/Documents/noodle/add_col.py", line 16

                                                 ^
SyntaxError: invalid syntax
logout

[Process completed]

脚本:

import csv

# fieldnames = ['name','degrees','area','phone','email','website']

with open('ieca_first_col_fake_text.txt', 'r') as input:
    with open('new_col.txt', 'w') as output:
        writer = csv.writer(output)
        for row in csv.reader(input):
            writer.writerow(row+['Berry'])
            writer.writerow(row.append('new_col')

# with open('ieca_first_col_fake_text.txt','r') as input:
#     with open('new_col_dict.txt','w') as output:
#         dict_writer = csv.DictWriter(output, fieldnames, delimiter = '\t')
#         dict_reader = csv.DictReader(input)

ありがとう!

4

1 に答える 1

3

この行の締めくくり)に失敗しました:

writer.writerow(row.append('new_col')
                                     ^         
                                     | 
于 2013-07-08T14:33:58.823 に答える