question about endswith()

Tom Zych freethinker at pobox.com
Fri Mar 4 04:26:33 EST 2011


Ethan Furman wrote:
> What is extensions?  A string or a tuple?  I'm guessing a string,
> because then you're looking at:
> 
> --> filename.endswith(x) for x in 'hdf5'
> 
> which is the same as
> 
> --> filename.endswith('h') or filename.endswith('d') or
>     filename.endswith('f') or filename.endswith('5')
> 
> and then both .hdf and .hdf5 files will get matched.

Score:5, Insightful.

"Oh, I'm sorry, this is Python. Slashdot is room 12A, next door."

-- 
Tom Zych / freethinker at pobox.com
Q: I'm having problems with my Windows software. Will you help me?
A: Yes. Go to a DOS prompt and type "format c:". Any problems you are
   experiencing will cease within a few minutes. -- Hacker Howto



More information about the Python-list mailing list