base64 miss encodestring

use*_*717 3 python base64

import base64
if __name__ == '__main__':
    res = base64.encodestring('srcdasd')        
    print(res)
Run Code Online (Sandbox Code Playgroud)

我在控制台python base64.py中运行,得到以下错误消息.

但我可以正确地在textMate中运行它.

AttributeError:'module'对象没有属性'encodestring'

Die*_*sch 7

您的文件名不应该是base64.py,它会与您正在使用的模块发生冲突.重命名您应该解决的文件.