Discuss / Python / 疑问{'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9}[s]

疑问{'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9}[s]

Topic source

csy魏

#1 Created at ... [Delete] [Delete and Lock User]

这段为什么不直接写成map(int,s)?

csy魏

#2 Created at ... [Delete] [Delete and Lock User]

没看到下面的int了

沙滩裤袜

#3 Created at ... [Delete] [Delete and Lock User]

其实一直没搞明白为什么后面都是要加个[s]?能帮小白解答下吗?

iPeony

#4 Created at ... [Delete] [Delete and Lock User]

相当于先创建了一个dict,后面用dict[key]来取值


  • 1

Reply