Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
文字列数字をint型リストにする
input_num="1,2,3,4"
print("### original ###")
print(input_num)
print("### result split ###")
print(input_num.split(","))
print("### result split map ###")
print(map(int,input_num.split(",")))
print(type(map(int,input_num.split(","))))
### original ###
1,2,3,4
### result split ###
['1', '2', '3', '4']
### result split map ###
[1, 2, 3, 4]
<type 'list'>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.