Thank you both for clearing that up.
-Basilisk96
--
http://mail.python.org/mailman/listinfo/python-list
"Basilisk96" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| "Terry Reedy" <[EMAIL PROTECTED]> wrote:
| > Any what if 'filelist' is any iterable other than a string or list?
Your
| > code is broken, and unnecessarily so. So I would call the parameter
| > 'files' and test for isins
In <[EMAIL PROTECTED]>, Basilisk96
wrote:
> "Terry Reedy" <[EMAIL PROTECTED]> wrote:
>> Any what if 'filelist' is any iterable other than a string or list? Your
>> code is broken, and unnecessarily so. So I would call the parameter
>> 'files' and test for isinstance(files, str) #or basestring.
"Terry Reedy" <[EMAIL PROTECTED]> wrote:
> Any what if 'filelist' is any iterable other than a string or list? Your
> code is broken, and unnecessarily so. So I would call the parameter
> 'files' and test for isinstance(files, str) #or basestring. And wrap if it
> is.
Can you give an example of
"Basilisk96" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| On Jun 8, 11:54 am, "T. Crane" <[EMAIL PROTECTED]> wrote:
| You can also do this (if tuples are okay in your case):
|
| a = 1,
|
| The comma turns 'a' into a tuple (1,) which is both iterable and has a
| length of 1.
|
| I
On Jun 8, 11:54 am, "T. Crane" <[EMAIL PROTECTED]> wrote:
> >> any suggestions are appreciated,
>
> > Yes, don't try iterating over objects that are not iterable. ;-)
>
> Ah, yes... I hadn't thought of that :)
>
> thanks,
> trevis
>
>
>
> > What you *can* do is iterating over lists, tuples or othe
>
>> any suggestions are appreciated,
>
> Yes, don't try iterating over objects that are not iterable. ;-)
Ah, yes... I hadn't thought of that :)
thanks,
trevis
>
> What you *can* do is iterating over lists, tuples or other iterables with
> just one element in them. Try ``a = [1]``.
>
> Ciao,
In <[EMAIL PROTECTED]>, T. Crane wrote:
> Can someone please explain to me why I can't do something like this:
>
> a = 1
>
> for value in a:
> print str(value)
>
> If I run this I get the error:
>
> 'int' object is not iterable
Well the message explains why you can't do this. `a` is boun