0
输入格式:
第一行:一个整数“n”个
下一个“n”个行:一个整数,在
之间实施例与空间的字符串:
python3服用int和字符串的组合
20
0 ab
6 cd
0 ef
6 gh
4 ij
0 ab
6 cd
0 ef
6 gh
0 ij
4 that
3 be
0 to
1 be
5 question
1 or
2 not
4 is
2 to
4 the
有没有更好的方式来接受输入并将其存储在列表中。 我的代码:
n=int(input())
l=list(map(lambda i:(int(i[0]),i[1]),[[i for i in input().split()] for j in range(n)]))
在什么意义上的 “好”? – alfasin
首先我将所有的输入和存储在一个列表中,然后我使用map()。有没有办法让每一行被proprocessed然后存储在列表中。 – Jade21