可以在python的同一行中进行输入和检查吗?
例如)在 C 中我们有
if (scanf("%d",&a))
如果给出整数输入,上述语句 if 块将起作用。但同样,
if a=input():
在 python 中不起作用。有没有办法做到这一点?
可以在python的同一行中进行输入和检查吗?
例如)在 C 中我们有
if (scanf("%d",&a))
如果给出整数输入,上述语句 if 块将起作用。但同样,
if a=input():
在 python 中不起作用。有没有办法做到这一点?