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, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to