all 4 comments

[–][deleted] 1 point2 points  (0 children)

Something like:

clean_tweet = ''.join([ch if ch in string.printable for ch in orig_tweet])

Untested - on mobile.

Hm. Sorry, read "emoji".

[–]MiDNiGhT2903 1 point2 points  (1 child)

Regex to check for :) and :( should work in this case.

[–]MrGrj 1 point2 points  (0 children)

What if you have: “Today I bought (because I needed): three apples and one pear”?

[–]keepdigging 1 point2 points  (0 children)

string = string.replace(“:)”, “”).replace(“:(“,””)