Discuss / Python / 这个a=int(a)什么意思

这个a=int(a)什么意思

Topic source

天将python

#1 Created at ... [Delete] [Delete and Lock User]
在此插入代码

a=input('please write a number:') a=int(a) if a >= 0: print(a) else: print(-a)

谢谢

天将python

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

“a=int(a)” 或者可以改成其他的什么吗

Ghoct_歌塔

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

应该是可以改成不同的数据类型吧,可以改成浮点型float(a)

将a转化成int型啊

Wooya君

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

a=input('please write a number:')语句赋给a的值是str类型,int(a)的作用是将a的值转化为int类型


  • 1

Reply