当前位置: 动力学知识库 > 问答 > 编程问答 >

six.b(literal) same as b'literal'? Python 2/3

问题描述:

I have a piece of code, are these two equivalent? I understand that six module is used for making code compatible with both 2 and 3.

from six import b

os.write(w, b("EMount unsuccessful"))

os.write(w, b"EMount unsuccessful")

网友答案:

It depends on the python version you are using. In 2.6 or higher, those are equivalent and you can use u instead of u().

分享给朋友:
您可能感兴趣的文章:
随机阅读: