Qpython unicode strings

房东的猫 提交于 2020-01-24 12:18:11

问题


I'm trying to port a Python 3.5 project from PC to Android QPython3 but for the line:-

if ch = in u'\x00\xe0':
    ch = getwch()

I'm getting this when I run it:-

if ch = in u'\x00\xe0':
                ^
  SyntaxError: invalid syntax

I thought QPython3 was supposed to run all 3.x scripts and the Unicode 'u' prefix isn't a new addition so what can the problem be? Are hex numbers in strings treated differently?


回答1:


To answer my own question, after much fiddling about I got it to work using:-

if ch in bytes([0x00, 0xe0]):

instead.



来源:https://stackoverflow.com/questions/35866148/qpython-unicode-strings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!