腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
1
回答
如何将
字符串
添加到
unicode
中
而不会因
unicode
转义而出现错误?
python-unicode
、
unicode-string
、
unicode-escapes
这基本上是我想要做
的
:
unicode
_string = "366d"
unicode
_string_with_u = u"\u%s" % (
unicode
_string) 它提供了: SyntaxError: (
unicode
error) 'unicodeescape' codec can't decode bytes in position 0-1: truncated \uXXXX escape 我有一个
迭代
,
浏览 28
提问于2019-12-08
得票数 0
2
回答
数据集中
unicode
的
规范化
python
、
unicode
、
normalize
目前,我
的
代码如下:
unicode
= open("
unicode
.txt").read()print(
unicode
) 其中
unicode
.txt是一个只读取\u00e9
的
文本文件。当我运行程序时,输出仍然是\u00e9,但是,如果我将.normalize行
中</e
浏览 1
提问于2018-10-23
得票数 0
2
回答
如何使用
python
3将符号转换为各自
的
unicode
表示?
python
、
python-3.x
、
unicode
、
python-3.5
我希望将devanagri脚本
字符
(如'अ‘)转换为其
unicode
表示形式
的
अ。在
python
2.7
的
早期,我使用了each_character.encode("
unicode
_escape"),其中each_character引用devanagri脚本
字符
。但是最近我开始处理
python
3,当我运行上面的代码片段时,会得到以下错误?expected str instance, bytes found 有人能建议一种将所
浏览 3
提问于2017-05-13
得票数 0
回答已采纳
3
回答
迭代
Python
中
的
unicode
字符串
python
、
unicode
、
python-2.x
我在
迭代
unicode
字符串
、逐
字符
迭代
python
时遇到了一个问题。print "w: ",word print "word: ",cw: 文本word: ?文当我使用len(word)时,我得到了6。显然,每个
字符
都是3个
unicode
块。 因此,我<e
浏览 1
提问于2015-06-22
得票数 9
回答已采纳
3
回答
Python
:在
python
2和
python
3
中
使用
unicode
文本
的
方式相同
python
、
python-3.x
、
unicode
我已经很多年没有编写
python
代码了,所以我
的
问题可能是愚蠢和简单
的
。我加载json数据:data = json.loads('{"hello": "world"}')在
python
3:data['
浏览 1
提问于2018-09-10
得票数 2
回答已采纳
2
回答
如何将带下划线
的
字符串
转换为
unicode
?
python
、
unicode
我尝试用
python
中
的
string元素创建数组。a = array('u',["sub_id","datetime"])创建数组
的
原因是通过请求发送数组。我在一些产品和发送请求
的
JSON中使用rest,但是它说这个param必须是一个数组。(tuple和list不适合) 我使用
python
3.4.4,如何解决这个问题?
浏览 3
提问于2017-07-07
得票数 0
回答已采纳
1
回答
sys.maxunicode是什么意思?
python
、
unicode
CPython根据编译选项在内部将
unicode
字符串
存储为utf-16或utf-32。在构建
的
utf-16版本
中
,
Python
字符串
分割、
迭代
和len似乎是在代码单元上工作,而不是在代码点上工作,因此多字节
字符
的
行为很奇怪。'u'\udc9e' 根据
Python
文档,是“一个整数,它给出了
Unicode
字符</e
浏览 3
提问于2011-09-21
得票数 7
2
回答
python
2.7
中
列表
中
的
俄语
python
、
python-2.7
、
utf-8
它必须打印Привет但是当我运行这段代码时,它会打印Привет不幸
的
是,它没有打印出我需要
的
东西。
浏览 0
提问于2013-07-08
得票数 1
回答已采纳
1
回答
python
字符串
索引访问
的
时间复杂度?
python
、
string
、
python-3.x
如果我没记错的话,
Python
字符串
是以
unicode
标量存储
的
。但是,
unicode
标量可以组合在一起形成其他字素群集。因此,在string[n]中使用内存置换start + scalarSize * n并不是您想要
的
答案。word = 'caf' + char(65) + char(301) #café
Python</
浏览 0
提问于2016-06-27
得票数 10
4
回答
用
Python
查找
字符串
中
的
unicode
字符
python
、
string
、
python-2.7
、
unicode
我对
python
很陌生,也许这个问题不是很聪明,但无论如何,我不能解决这个小问题。像往常一样,例如在条件语句中,为了在
字符串
中找到某个
字符
或子
字符串
,我习惯于编写以下代码: <do something> 但是,如果该
字符
或子
字符串
是具有较高代码点
的
unicode
字符
,例如,一个UnicodeDecodeError: 'ascii'
浏览 2
提问于2017-04-28
得票数 1
回答已采纳
3
回答
返回
unicode
字符串
的
前N个
字符
python
、
unicode
、
python-2.x
我有一个
unicode
格式
的
字符串
,需要返回前N个
字符
。我正在这样做:当然,
unicode
字符串
的
长度!=
字符
的
长度。有什么想法吗?唯一
的
解决方案是使用re?我认为
unicode
字符串
是两个字节(char),这就是为什么会发生这种情况。如果我这样做了:我得到了这是正确
的</
浏览 0
提问于2010-01-28
得票数 11
回答已采纳
2
回答
使用
unicode
字符
迭代
字符串
时对
字符串
的
错误解释
python
、
python-2.7
、
utf-8
、
character-encoding
我在MacOSx10.6上运行
python
2.7,文件在utf8
中
,终端在utf8
中
。为什么我要得到带有问号
的
字句?在进一步
的
研究
中
,仅仅这样做会产生同样
的
问号。但是在前面显式地添加u给出了for letter in u'åäö': print le
浏览 0
提问于2013-06-01
得票数 0
回答已采纳
2
回答
Gunicorn (
Python
3.4和3.3)响应时只发送没有数据
的
标头
python
、
python-3.x
、
wsgi
、
gunicorn
我在云中有vm,
python
3.3(也尝试了3.4 -相同
的
结果)和Gunicorn 18。return iter([data])gunicorn -w 4 -b 0.0.0.0:8000 app:appConnection: "close"...and so on 如果我添加一些自定义标题,我将得到它
的
响应,但没有响应主体。
浏览 3
提问于2014-04-09
得票数 7
回答已采纳
1
回答
python
的
字符串
是
unicode
字符
python
、
unicode
Python
3
字符串
中
的
Unicode
characters是什么意思? 从
py
浏览 2
提问于2016-03-25
得票数 3
回答已采纳
5
回答
函数在我认为应该返回False时不返回False。
python
、
loops
、
if-statement
编写
python
函数来
迭代
字符串
。如果
字符串
中有非英语
字符
,我希望它返回False。return False return True return False return True print(ord('
浏览 11
提问于2021-12-13
得票数 1
回答已采纳
1
回答
在
Python
中
搜索
Unicode
字符
python
、
unicode
、
nltk
我正在开发一个基于
Python
/NLTK
的
非英语
unicode
文本
的
NLP项目。为此,我需要在句子
中
搜索
unicode
字符串
。有一个.txt文件和一些非英语
的
unicode
语句一起保存.使用NLTK PunktSentenceTokenizer,我对它们进行了分解,并保存在一个
python
中
。sentences = PunktSentenceTokenizer().tokenize(tex
浏览 1
提问于2013-08-04
得票数 0
回答已采纳
3
回答
Python
:
迭代
字符串
中
的
unicode
字符
python
、
unicode
我想遍历
Unicode
字符串
中
的
每个
字符
,并且我是这样做
的
: import unicodedata print(char_name + ": " + char + " : " + json.dumps(char)) # comment out 但是输出是这样
的
浏览 61
提问于2021-06-16
得票数 0
回答已采纳
2
回答
Python
-
Unicode
python
、
unicode
一个简单脚本
的
执行并不像想象
的
那样进行。print "hooray" print "finished" 输出返回未更改
的
单词
浏览 0
提问于2012-03-08
得票数 0
回答已采纳
4
回答
如何比较
字符串
的
每个
字符
,同时计算长度> 1
的
字符
?
java
、
string
、
unicode
、
character-encoding
、
utf-16
我有一个变量
字符串
,它可能包含任何
unicode
字符
。这些
unicode
字符
中
的
一个是汉。 if ( char
浏览 0
提问于2015-06-07
得票数 16
回答已采纳
1
回答
addPortalMessage需要解码(‘utf-8’)
encoding
、
utf-8
、
plone
目前看来,为了让UTF-8
字符
显示在门户消息
中
,您需要首先对它们进行解码。下面是我代码
中
的
一个片段:如果Plone
中
的
标题已经编码了utf-8,那么
字符串
就是
un
浏览 1
提问于2014-07-09
得票数 0
回答已采纳
点击加载更多
热门
标签
更多标签
云服务器
ICP备案
对象存储
云点播
即时通信 IM
活动推荐
运营活动
广告
关闭
领券