我怎么能在Python写一个.py文件,使得它的类型不应该是这样“与Windows CRLF ASCII文件”如何生成没有默认窗口crlf的py文件?
,因为当我的窗口中运行file.write(data)
它写入文件,但是当我尝试 eval(open(file.py).read())
它失败,并给出了由于在每一行窗口CRLF语法错误......
看到错误日志 - 回溯
ERROR:web-services:[25]: info = eval(tools.file_open(terp_file).read(-1))
ERROR:web-services:[26]: File "<string>", line 1
ERROR:web-services:[27]: {
ERROR:web-services:[28]:
什么是你想怎么办?为什么? – SilentGhost 2010-04-29 12:28:07
也许你可以看看rstrip的功能。 – lbedogni 2010-04-29 12:28:57
@SilentGhost我相信他正在尝试编写代码生成工具(因此是标签)。 – seanhodges 2010-04-29 12:30:42