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]))