本文介绍了aifc 模块错误:Python 不会打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚开始使用 python,所以请耐心等待;)
I'm just getting started with python so please bear with me ;)
在遵循基本教程时,我在打开文件时遇到了问题,这是回溯:
While following a basic tutorial I ran into a problem while opening a file, here's the traceback:
File "/home/nick/Dropbox/workspace/pytest/schlange.py", line 55, in <module>
f=open("file.csv","r")
File "/usr/lib/python2.6/aifc.py", line 922, in open
return Aifc_read(f)
File "/usr/lib/python2.6/aifc.py", line 335, in __init__
self.initfp(f)
File "/usr/lib/python2.6/aifc.py", line 288, in initfp
raise Error, 'file does not start with FORM id'
aifc.Error: file does not start with FORM id
这是否意味着我的 Python 安装中的aifc.py"已损坏,或者我是否错过了此处的重要内容?
Does that mean that 'aifc.py' in my python installation is broken or did I miss something important here?
推荐答案
您已决定从 aifc
及其 open()*
/code> 隐藏了内置的 open()
.这就是我们不导入 *
的原因.而是导入模块本身,并在需要时使用引用来获取其名称,例如aifc.open()
.
You've decided to import *
from aifc
, and its open()
has shadowed the built-in open()
. This is why we don't import *
. Import the module itself instead and use the reference to get to its names when required, e.g. aifc.open()
.
这篇关于aifc 模块错误:Python 不会打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!