三、基本数据类型的转换

int, float,boolean 转字符串

# -*- coding:utf-8 -*-i = 10 istr = str(i) print(istr)f = 1.0 istr = str(f) print(istr)b = True istr = str(b) print(istr)

【三、基本数据类型的转换】字符串转int、float、boolean
i = 10 print(str(i))f = 3.0 print(float(f))b = True print(bool(b))

    推荐阅读