Python-程序語法 - Python注釋&基本函數(shù)
Python注釋
以# 為行開頭為注釋
相關(guān)函數(shù)
str() --- 傳入一個(gè)整型值,并求值為它的字符串形式
Python 2.7.17 (default, Mar 8 2023, 18:40:28)
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> str(94343)
'94343'
>>> print('I am' + str(18) + 'Years old.')
I am18Years old.
>>> print('I am' + str(18) + 'Years old.')
I am18Years old.
>>> print('I am ' + str(18) + ' Years old.')
I am 18 Years old.
>>>
int() --- 與str()將輸入值轉(zhuǎn)換為字符串相反,int()函數(shù)將字符串?dāng)?shù)據(jù)作為輸入,輸出為整數(shù)!
>>> int(1234)
1234
>>> int(34)
34
>>> int(-9990)
-9990
float() --- 將輸入字符串求取浮點(diǎn)數(shù)形式的值
>>> float(1099)
1099.0
>>> float(-999)
-999.0

浙公網(wǎng)安備 33010602011771號(hào)