Thread: Reading a file
View Single Post
Old 05-04-2006, 08:15 AM   #18 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,695
redhead is on a distinguished road
You're not sure this has something todo with either <space> or <tab> seperating the items in your lines ?
The code will only transform spaces into commas, it wont do a thing if theres a <tab>, but this can be fixed by telling the compile() to search for ' |\t' ie:
Code:
for line in f.readlines():
    returnline.append(re.compile('( |\t)').sub(',', line[0:-1]))
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote