Qpython unicode strings

2019-07-12 02:34发布

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条回答
神经病院院长
2楼-- · 2019-07-12 03:14

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

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

instead.

查看更多
登录 后发表回答