小编And*_*di 的帖子

'UCS-2'编解码器无法对1050-1050位置的字符进行编码

当我运行我的Python代码时,我收到以下错误:

  File "E:\python343\crawler.py", line 31, in <module>
    print (x1)
  File "E:\python343\lib\idlelib\PyShell.py", line 1347, in write
    return self.shell.write(s, self.tags)
UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 1050-1050: Non-BMP character not supported in Tk
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

x = g.request('search', {'q' : 'TaylorSwift', 'type' : 'page', 'limit' : 100})['data'][0]['id']

# GET ALL STATUS POST ON PARTICULAR PAGE(X=PAGE ID)
for x1 in g.get_connections(x, 'feed')['data']:
    print (x1)
    for x2 in x1:
        print (x2)
        if(x2[1]=='status'):
            x2['message']
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?

python unicode encoding ucs2

11
推荐指数
1
解决办法
3万
查看次数

标签 统计

encoding ×1

python ×1

ucs2 ×1

unicode ×1