(newbie)list conversion problem

Steve McAllister nosp at m.needed
Thu Jun 19 15:35:36 CEST 2003


> I want this list: ['7659', '33', '454', '445'] to change in something
> like this: [7659, 33, 454, 445].

map(int, ['7659', '33', '454', '445'])

> for elements in x:
>   group = []
>   group.append(int(elements))
> 
> and I got gibberish

You certainly wanted to:

group = []         # Once!
for el in x:
     group.append(int(el))





More information about the Python-list mailing list