1. 程式人生 > >Python中輸入資料,以空格分隔

Python中輸入資料,以空格分隔

參考連結

# -*-coding:utf8-*-

# 用空格獲取輸入資料的兩種方法, map()的返回值是一個迭代器
num1 = list(map(int, input().strip().split()))
num2 = [int(temp) for temp in input().split()]