Hi Tim my posting is not really related to the scanf discussion but maybe helpful ... Tim Hammerquist wrote: > or, much more preferably: > > if filename[-4:] == '.txt': > ... Since (I think:) Python 2.0 it's possible to use if filename.endswith('.txt'): ... which is less error-prone if the string is a bit longer. Stefan