simple files continued
Darren Teo
darrenteo82 at yahoo.com
Sat May 31 04:50:29 EDT 2003
def readtable(filename):
intabfile = open(filename, "r")
tablist = []
for tablines in intabfile:
if not tablines.startswith("#"):
tablist.append(string.split(tablines, ":", 10))
tablist.append(tablines.rstrip()) # when i put this i get the output below #
intabfile.close()
return tablist
[['why', '2', 'crap', 'hehe\n'], 'why:2:crap:hehe', ['say', '4', 'test', '6\n'], 'say:4:test:6', ['what', '7', '0', 'damn \n'], 'what:7:0:damn']
how do i remove the \n ?? and output to be
[['why', '2', 'crap', 'hehe'], ['say', '4', 'test', '6'], ['what', '7', '0', 'damn']]
Thanks
---------------------------------
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030531/779e5e55/attachment.html>
More information about the Python-list
mailing list