At 09:04 AM 9/25/2006, Carroll, Barry wrote:
>Hello, Dick.
>
>Let's compare your final startswith method and the endswith method in
>is_image_file:
>
> >>>>>>>
>s.startswith("er","q","ty")
>filename.endswith(('.gif', '.jpg', '.tiff'))
> >>>>>>>
>
>Notice that, while startswith has THREE parameters, endswith has only
>ONE. ('.gif', '.jpg', '.tiff') is a tuple, and the interpreter sees it
>as a single parameter. In other words your method is passing the
>following parameters:
>
> prefix = "er"
> start = "q"
> end = "ty
>
>while the example method is passing:
>
> suffix = ('.gif', '.jpg', '.tiff')
> start = None
> end = None
>
>Does that make sense?
Sure does now.
Thanks, Barry
Dick
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor