Created
February 1, 2016 15:19
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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