reading from a txt file
Denis McMahon
denismfmcmahon at gmail.com
Thu Nov 26 15:50:26 EST 2015
On Thu, 26 Nov 2015 12:34:36 -0800, vincentypedro wrote:
> Hey, I'm wondering how to read individual strings in a text file. I can
> read a text file by lines with .readlines() ,
> but I need to read specifically by strings, not including spaces.
> Thanks in advance
How do you define a string? Is it just a line with the spaces removed?
>>> "".join(" this is a test string my friends ".split(" "))
'thisisateststringmyfriends'
--
Denis McMahon, denismfmcmahon at gmail.com
More information about the Python-list
mailing list