如何在除#字符之外的任何标点符号和空格处拆分字符串?
tweet="I went on #Russia to see the world cup. We lost!"
我想这样分割下面的字符串:
["I", "went", "to", "#Russia", "to, "see", "the", "world", "cup", "We","lost"]
我的尝试:
p = re.compile(r"\w+|[^\w\s]", re.UNICODE)
由于它创建的是“ Russia”而不是“ #Russia”,因此不起作用
守候你守候我
牧羊人nacy
相关分类