Skip to content

Instantly share code, notes, and snippets.

@suganoo
Last active October 22, 2017 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suganoo/c477e0c1b4bcd1776410450b6edc8de5 to your computer and use it in GitHub Desktop.
Save suganoo/c477e0c1b4bcd1776410450b6edc8de5 to your computer and use it in GitHub Desktop.
文字列数字を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