Qpython unicode字符串 [英] Qpython unicode strings

查看:117
本文介绍了Qpython unicode字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Python 3.5项目从PC移植到Android QPython3,但要进行以下操作:-

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

我以为QPython3应该运行所有3.x脚本,而Unicode 'u'前缀不是新增功能,那么问题可能是什么呢?字符串中的十六进制数字是否有所不同?

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?

推荐答案

回答了我自己的问题之后,经过一番摆弄之后,我开始使用:-

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

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

相反.

这篇关于Qpython unicode字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆