Manish Ranjan
Manish Ranjan

Reputation: 11599

Python String strip for new lines on a twitter feed

I have a twitter text like this what i am trying is to trim all new lines and make it a single string

Text is-------------> RT @KajuBadamChor: Who are we?. Indian.

what do we wan't?

American Visa.

Why do we wan't it?.

we wanna work for naughty America.

But why?

Because YPD2.

Expecting

Text is-------------> RT @KajuBadamChor: Who are we?.Indian.what do we wan't?American Visa.Why do we wan't it?.we wanna work for naughty America.But why?Because YPD2.

i have tried var[i]['text'].rstrip("\n")

that is right strip for new line characters but it doesn't seems to be giving the o/p i expect , i have been coding python for last few days hence i am sure i am missing something very simple , Help please , suggestions willd o , not expecting you to give me a code solution :)

Thanks

Upvotes: 1

Views: 415

Answers (1)

user2472657
user2472657

Reputation: 48

var[i]['text'] = var[i]['text'].replace('\n', '')

Upvotes: 2

Related Questions