+ 3
remove the lines
I have a txt file in which I want remove all new lines eg ab cd ef I want it : abcdef using python
2 Answers
+ 1
thanks alot
0
if you read from a file, you can do (assuming f is the name of the file):
''.join(f.readlines())
''.join() will concatenate what is inside the parentheses, putting the string in front in-between
and f.readlines() will return a list of all the lines in the file f