Can Readlines() go to next line after a Tab

tim at preservedwords.com tim at preservedwords.com
Tue Jun 26 21:16:56 EDT 2007


I have a module based app that can load many modules at startup. The modules are text based with a '\t' separating the keyword from the definition. The app reads each module to extract the keywords, but because readlines() must read to the end of the current line to get to the next, the module loading is slow.

Is there a way to have readlines() go to the next line when it finds a tab '\t' instead of a newline '\n'?

Is there a better way to do this?

I know a second file could be made of the keywords only, but I would like to have only one file. 

Thanks,
Tim



More information about the Python-list mailing list