python中如何将int类型数据转换为字符串类型

时间:2024-10-31 14:46:55

1、打开pycharm,并且新建一个py文件。

python中如何将int类型数据转换为字符串类型

2、定义一个int类型的变量a = 466。

python中如何将int类型数据转换为字符串类型

3、利用print(type(a))来查看变量a的类型,为int类型。

python中如何将int类型数据转换为字符串类型

4、将a = str(a),将变量a的类型转换为字符串类型。

python中如何将int类型数据转换为字符串类型

5、再次打印变量a的数据类型,可以看到转换为str,字符串类型了。

python中如何将int类型数据转换为字符串类型
© 手抄报圈