python字符串與數字類型轉換

str與intpython i = 10 s = str(i) #s = '10' s = '1' i = int(s) #i = 1 str與float算法 st = '.4' t = float(st) # t = 0.4 st = '0.4' t = float(st) # t = 0.4 t = 0.4 st = str(t) # st = '0.4' 注意把字符串轉換爲數字類型時
相關文章
相關標籤/搜索