+ 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

6th Feb 2018, 6:06 AM
Abdurrahman Abulgasim
Abdurrahman Abulgasim - avatar
2 ответов
+ 1
thanks alot
6th Feb 2018, 7:02 AM
Abdurrahman Abulgasim
Abdurrahman Abulgasim - avatar
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
6th Feb 2018, 9:59 PM
Amaras A
Amaras A - avatar