[英]re.compile("[" ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-7: truncated \UXXXXXXXX escape
I want to run this code so as to get every happy emoji in my tweets.我想运行这段代码,以便在我的推文中获得每个快乐的表情符号。 But I am getting error.但我收到错误。 I am using google colab.我正在使用谷歌colab。 I am doing this.我正在这样做。
emoji_pattern_happy = re.compile("["
u"\U0001F600"
u"\U0001F617" # emoticons
u"\U0001F642"
u"\U0001F60A"
u"\U0001F60D"
u"\U0001236A"
u"\U0001F61A"
u"\U0001F63A"
u"\U0001F63B"
u"\U0001F61B"
u"\U0001F60E"
u"\U0001F60C"
u"\U0001F642"
u"\U0001F923"
u"\U0001F494"
u"\U00012764"
u"\U0001F499"
u"\U0001F49C"
u"\U0001F9OE"
u"\U0001F970"
u"\U0001F64C"
u"\U0001F4AF"
u"\U0001F91D"
u"\U0001F49F"
u"\U0002763"
u"\U0001F913"
u"\U0001F415"
u"\U0001F4AB"
u"\U0001F91F"
u"\U0001F44D"
u"\U0001F44F"
u"\U0001F924"
u"\U0001F496"
u"\U0001F497"
u"\U0001F493"
u"\U0001F49B"
u"\U0001F49A"
u"\U0001F920"
u"\U000F9E1"
u"\U0001F48B"
u"\U0001F48C"
u"\U0001F498"
u"\U0001F49D"
u"\U0001F973"
u"\U0001F917"
u"\U0001F638"
u"\U0001F642"
"]+", flags=re.UNICODE)
You left a 1
out of u"\\U0002763"
and u"\\U000F9E1"
;你在u"\\U0002763"
和u"\\U000F9E1"
留下了1
; presumably you meant u"\\U00012763"
(not sure on that) and u"\\U0001F9E1"
(seems likely).大概你的意思是u"\\U00012763"
(不确定)和u"\\U0001F9E1"
(似乎很可能)。 \\U
escapes require precisely eight hex digits. \\U
转义需要精确的八个十六进制数字。 Luckily, the SyntaxError
prevented you from accidentally searching for some random unrelated character.幸运的是, SyntaxError
防止您意外搜索一些随机的无关字符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.