[Tutor] Zipfile and File manipulation questions.

Chris Hengge pyro9219 at gmail.com
Sun Oct 15 01:05:34 CEST 2006


Got that working now, thanks.

I've been using activepythons release, and they dont have 2.5 prepared yet.
Guess I should just upgrade without them?

On 10/14/06, Kent Johnson <kent37 at tds.net> wrote:
>
> Chris Hengge wrote:
> > Oops.... I get an error using that code..
> >
> >     if filename.endswith('.cap','.fru','.hex') or
> > filename.endswith('.sdr', '.cfg'):
> > TypeError: slice indices must be integers or None
>
> With Python 2.5 you can do this with a tuple argument. You need an extra
> set of parentheses to create the tuple:
> if filename.endswith(('.cap','.fru','.hex', '.sdr', '.cfg')):
>
> In Python 2.4 or less you need a separate endswith() for each ending.
>
> Kent
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061014/71056432/attachment.html 


More information about the Tutor mailing list