当我尝试转换unicode时:
a = u"????"
Run Code Online (Sandbox Code Playgroud)
要字符串:
str(a)
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误:
'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
Run Code Online (Sandbox Code Playgroud)
我需要str(a)给我输出:
>> str(a)
>> '????'
Run Code Online (Sandbox Code Playgroud) 我需要在python中使用正则表达式来获取{}中的所有单词
a = 'add {new} sentence {with} this word'
Run Code Online (Sandbox Code Playgroud)
re.findall的结果应该是[new,with]
谢谢