use*_*080 6 python python-idle
我试图弄清楚如何在Windows 7上成功使用Python 2.7.1.
到目前为止,我不得不使用shell(IDLE)来创建脚本,然后从cmd提示符运行它们.我觉得这会减慢学习过程,我想知道是否有办法从IDLE运行它(我无法创建路径,所以每当我尝试打开或导入文件时我都会收到错误)或还是其他一些程序/文本编辑器?
任何帮助,将不胜感激!我可能只是做错了什么.
Mar*_*nen 19
>>>提示.编辑
我通常不使用IDLE,并且没有立即看到为模块配置参数的方法,因此一个建议是切换IDE.由于您使用的是Windows 7,因此pywin32扩展包含PythonWin IDE,其运行命令有一个对话框,允许输入命令行参数.
我认为您要记住以下功能:
execfile(...)
execfile(filename[, globals[, locals]])
Read and execute a Python script from a file.
The globals and locals are dictionaries, defaulting to the current
globals and locals. If only globals is given, locals defaults to it.
Run Code Online (Sandbox Code Playgroud)
这仅适用于python 2.x,而python 3没有execfile(),而是请参阅python 3中execfile的替代方法是什么?