[Tutor] Slicing Question

Andreas Zwinkau andi@buxach.de
Wed Apr 9 13:09:01 2003

Wed, 09 Apr 2003 12:46:26 -0400: Brian Christopher Robinson
> I wrote this line of code today:
> if fileName[:-5][-4:].lower() == "test":
> What it does it take a file name that I already know ends in ".java",
> cut off the ".java" part, and see if the last 4 letters are test.  I
> was wondering if there's a simpler way of doing this?

if fileName[-9:-5].lower() == "test":

would be my suggestion, but i am a newbie myself :-P

Andreas Zwinkau
 | web: andi.dasstellenwirinsinternet.de
 | mail: andi@buxach.de
 | jabber: beza1e1@amessage.de

Amikeco aparte, afero aparte