我有一张excel表格,只有一列,标题是Name,下面的行是Jerry。我要做的就是用python加上标题:a g e,然后在下面加一行,比如14。
我该怎么做?
with open('simpleexcel.csv', 'r') as f_input: # Declared variable f_input to open and read the input file
input_reader = csv.reader(f_input) # this will iterate ober lines from input file
with open('Outputfile.csv', "w", newline='') as f_output: # opens a file for qwriting in this case outputfile
line_writer = csv.writer(f_output) #If csvfile is a file object, it should be opened with newline=''
for line in input_reader: #prints every row
line_writer.writerow(line+['14'])
相反,我得到14分和14分,我不知道怎么得到另一个头球
我首先要做的是
Name
Jerry
Name Age
Jerry 14
相反,我得到:
Name 14
Jerry 14
我怎样才能修改上面的代码?