Skip to content Skip to sidebar Skip to footer

Stripping Line Breaks In Tweets Via Tweepy

I'm looking pull data from the Twitter API and create a pipe separated file that I can do further processing on. My code currently looks like this: auth = tweepy.OAuthHandler(CON

Solution 1:

That is because strip returns "a copy of the string with leading and trailing characters removed".

You should use replace for the new line and for the pipe:

post = post.replace('|', ' ')
post = post.replace('\n', ' ')

Post a Comment for "Stripping Line Breaks In Tweets Via Tweepy"