在Python中,我们可以使用str()将int转换为String。
num1 = 100print(type(num1)) # 'int'>
num2 = str(num1)
print(type(num2)) # 'str'>
输出量
<class 'int'>
<class 'str'>
参考文献:
Python文档– str()
Python –如何将String转换为int
翻译自: https://mkyong.com/python/python-how-to-convert-int-to-string/
今日福利?
推荐阅读--
每日一课 | Python的分支结构讲解
每日一课 | Python程序将字符串的M个字符重复N次
每日一课 | 读取浮点数
每日一课 | Python3 MySQL 数据库连接
每日一课 | 斐波那契数列的第n个项
球分享
球点赞
球在看