Use Python Standard Library’s linecache module:
line = linecache.getline(thefilename, 33)
should do exactly what you want. You don’t even need to open the file — linecache
does it all for you!
Use Python Standard Library’s linecache module:
line = linecache.getline(thefilename, 33)
should do exactly what you want. You don’t even need to open the file — linecache
does it all for you!