On 27/11/2013 01:18, Dominik George wrote:
for x in xrange(len(animal)):
if animal[x].isdigit():
animal[x] = int(animal[x])
Before posting anything else would you please do a tutorial
yourself. The above for loop is appalling newbie code, I'll leave
you to post the Pyth
Mark Lawrence schrieb:
>Dominik,
>
>I'm very sorry about the above, I really should know better than to
>post
>at stupid o'clock in the morning when I'm already exhausted.
Thanks, Mark :)!
-nik
___
Tutor maillist - Tutor@python.org
To unsubscribe or
On 11/27/2013 02:18 AM, Dominik George wrote:
>Before posting anything else would you please do a tutorial
>yourself. The above for loop is appalling newbie code, I'll leave
>you to post the Pythonic format.
Can I trust my ears? Did you just make a move to expell me from posting
newbie-readable
On 11/26/2013 08:00 PM, Sam Lalonde wrote:
Hi, I am very new to python.
I have a list with mixed strings/integers. I want to convert this to a
list of lists, and I want the numbers to get stored as integers.
list1 = ['dog 1 2', 'cat 3 4', 'mouse 5 6']
There is a little interpretation error
> >for x in xrange(len(animal)):
> >if animal[x].isdigit():
> >animal[x] = int(animal[x])
> >
>
> Before posting anything else would you please do a tutorial
> yourself. The above for loop is appalling newbie code, I'll leave
> you to post the Pythonic format.
Can I trust
On 27/11/2013 00:57, Dominik George wrote:
Hi,
I have a list with mixed strings/integers. I want to convert this to a
list of lists, and I want the numbers to get stored as integers.
First, let's do it with a list comprehension. You should really learn those if
you do serious Python program
On 26/11/13 19:00, Sam Lalonde wrote:
>>> list1 = ['dog 1 2', 'cat 3 4', 'mouse 5 6']
>>> list2 = []
>>> for animal in list1:
... animal = animal.split()
... list2.append(animal)
...
This could be a list comprehension:
list2 = [animal.split() for animal in list1]
>>> print list
On Wed, Nov 27, 2013 at 5:00 AM, Sam Lalonde wrote:
> Hi, I am very new to python.
>
> I have a list with mixed strings/integers. I want to convert this to a list
> of lists, and I want the numbers to get stored as integers.
>
list1 = ['dog 1 2', 'cat 3 4', 'mouse 5 6']
list2 = []
Hi,
> I have a list with mixed strings/integers. I want to convert this to a
> list of lists, and I want the numbers to get stored as integers.
First, let's do it with a list comprehension. You should really learn those if
you do serious Python programming ;)!
list2 = [[int(z) if z.isdigit(
Hi, I am very new to python.
I have a list with mixed strings/integers. I want to convert this to a
list of lists, and I want the numbers to get stored as integers.
>>> list1 = ['dog 1 2', 'cat 3 4', 'mouse 5 6']
>>> list2 = []
>>> for animal in list1:
... animal = animal.split()
... lis
10 matches
Mail list logo