transform strings list in a int lists or other type???

Sean 'Shaleh' Perry shalehperry at
Wed Sep 25 19:35:10 EDT 2002

On Wednesday 25 September 2002 16:29, jubafre at wrote:
>                   Can i tranform a list of strings in a list of int, or
> other type in python??? and also write in a file? I think the
> open(path,'wb') in __builtin__ dont´t write in a file other types, just
> strings, rigth???
> Juliano Freitas

string_ling = ['14, '42', '83']
int_list = map(int, string_list)

or in the newer pythons:

int_list = [int(i) for i in string_list]

there are equivalent conversion functions for the other types as well.

More information about the Python-list mailing list