Python NameError: 名称 'csv' 未定义
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44953012/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 00:40:17 来源:igfitidea点击:
NameError: name 'csv' is not defined
提问by Nicole
I am new to Python, and I want to write a csv file, that lists the roots of my equation. I am working on Sage. My code is :
我是 Python 新手,我想编写一个 csv 文件,其中列出了方程的根。我正在研究 Sage。我的代码是:
with open('out.csv', 'w') as f:
c = csv.writer(f)
c.writerows(root)
The error I am getting is " NameError: name 'csv' is not defined "
我得到的错误是“ NameError: name 'csv' is not defined ”
Can anybody help please?
有人可以帮忙吗?