我的csv writer不想再工作了,它仍然创建一个文件,但它不会向文件中添加任何数据。我发现csv.writer(f)
不起作用。弹出的错误是'AttributeError:'function'对象没有属性'writer'
我真的不知道出了什么问题。我用https://www.youtube.com/watch?v=s1XiCh-mGCA&t=165s作为我的模型。我也去了https://docs.python.org/3/library/csv.html看看他们是怎么写的,但我似乎找不出我和他们之间的主要区别。问这个我觉得像个傻瓜,但我好像听不懂
*编辑更多的内容,它不会让我张贴更多
def full():
wks1 = gc.open('RubricAutomation').worksheet(sheetname[lb.curselection()[0]])
marklist = list(zip(orgid[2:], mark[2:],late[2:])) #combines student ID and marks for CSV
toplist = list(zip(names[2:], commentList[2:])) #combines student names and comments for D2L
sorting = lambda toplist: toplist[0]
toplist.sort(key=sorting)
with open(location + asgnName + ".csv", 'w', newline='') as f: ## opens new csv file into location and adds name from gspread
writer = csv.writer(f)
writer.writerow(['OrgDefinedId', asgnName + " Points Grade", "End-of-Line Indicator"])
for i in marklist:
writer.writerow([ i[0],i[1] ,"#"])
目前没有回答
相关问题 更多 >
编程相关推荐