Skip to content

Instantly share code, notes, and snippets.

@ricardovsilva
Created February 1, 2016 15:19
Show Gist options
  • Save ricardovsilva/9ef8fb611b71f89240b4 to your computer and use it in GitHub Desktop.
Save ricardovsilva/9ef8fb611b71f89240b4 to your computer and use it in GitHub Desktop.
Example of use of map function. This is usefull to convert a list of some type to other.
string_list = ["92", "27", "45", "23"]
print string_list
#["92", "27", "45", "23"]
print string_list[0] + string_list[1]
#9227
integer_list = map(int, string_list)
print integer_list
#[92, 27, 45, 23]
print integer_list[0] + integer_list[1]
#119
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment