这是我的代码:
import base64
with open('/Users/Bob/test.txt') as f:
encoded = base64.b64encode(f.readlines())
print(encoded)
Run Code Online (Sandbox Code Playgroud)
我基于base64文档.但是,当我尝试使用Python 2.7.1和Python 3.2.2运行它时,我收到错误:
import base64
File "/Users/Bob/test.txt'", line 4, in <module>
encoded = base64.b64encode(f.readlines())
AttributeError: 'module' object has no attribute 'b64encode'
Run Code Online (Sandbox Code Playgroud)
为什么找不到该b64encode属性?
Ign*_*ams 60
您有一个名为base64.pyshadow stdlib模块的脚本.重命名它.
| 归档时间: |
|
| 查看次数: |
20554 次 |
| 最近记录: |