1543159687.4969957::我想我已经做了足够多的实验了,给出了一个更新:去年,人类的孩子对Blac\u 2026https://t.co/M3HR5fAoFZ是免费的“
这就是我所得到的结果。我想创建一个regex,用空格替换特殊元素,比如\u2019和\u2026。它们总是以"\u“开头,然后再继续四个字符。
我也想去掉html。它总是以"https://t.co/“开头,并继续使用10个字符。
我试过下面的代码,但显然是错误的。
tweet = re.sub("@[\\u].{4}", "", tweet)发布于 2018-11-25 15:50:22
这些\u字符只是unicode字符,没有什么需要做的,因为当您尝试使用print mystring时,它们将被自动转换
至于最后的网址,你可以:
removed = re.sub(r'http\S*$', '', mystring) # remove the final http string.
>>> removed
'1543159687.4969957::I think I’ve gotten far enough into my experiment to give an update: Last year, Child of Humanity was free for Blac… 'https://stackoverflow.com/questions/53469098
复制相似问题