[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ale] Python - read in text minus "\n"



I have a question for any Python programmers/hackers out there.

I am reading (with popen() ) the return from a grep search.  However, using 
read()  or readlines() also reads in "\n" after every result.  Anyone know 
how I can read it in without the newlines?  

I could of course read through the list and remove the last two characters of 
every item, but before i do that I wanted to make sure there isn't a function 
that reads without including \n, \t, \r and such.  Alternatively, maybe 
someone can suggest a regex to parse it out (I don't know regular expressions 
yet). 

Thanks for any input!
-Jay