Am 28.01.2009 um 00:29 schrieb Gregor Kopka:

also while looking at it i'm not that sure why you don't check the extension by checking against a[-4:] == ".png" which i feel like a bit more readable compared to your if condition. Do you want to stop your code from processing files with a "." in the name (like 'mypic 02.05.2007.png') ?


Actually why not rely on os.path to identify things correctly in the first place?

Which book still recommends code like this?

if string.find(a,'.') > 0 and string.split(a,'.')[1]=='png' and len(string.split(a,'.'))==2

Strings have had methods since Python 1.6!

But os.path.splitext() is probably all you need. Sorry that this won't help you find the cause of the crash.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to