Mah*_*shi 0 python string integer input python-3.x
我已经看到了以下链接以获得我的答案,但仍然没有得到预期的答案。
如果我在一行中提供 Name 和 Number,Python 应该将第一个值作为字符串,第二个作为整数。
a, b = [int(x) if x.isnumeric() else x for x in input().split()]
Run Code Online (Sandbox Code Playgroud)
如果可能,它将转换为 int 输入的任何部分。
| 归档时间: |
|
| 查看次数: |
1214 次 |
| 最近记录: |