[Tutor] Slicing Question

Brian Christopher Robinson brian@dungeoncrawl.org
Wed Apr 9 12:47:02 2003


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?


-- 
"Words are poison." - Nick on love