KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to convert Python multiline string to a single line. If I open the string in a Vim , I can see ^M at the start of each line. How do I process the string to make it all in a single line with tab separation between each line. Example in Vim it looks like: Serialnumber ^MName Rick ^MAddress 902, A.street, Elsewhere I would like it to be something like: Serialnumber \t Name \t Rick \t Address \t 902, A.street,...... where each string is in one line. I tried somestring.replace(r'\r','\t') But it doesn't work. Also, once the string is in a single line if I wanted a newline(UNIX newline?) at the end of the string how would I do that?
Tags (comma-separated)
Save Edits
Cancel