软件测试
字符串转数字 标签描述

前言 日常工作中,我们有的时候需要将一种类型的数据转换成其他类型的数据,便于我们的操作。 字符串与数字类型转换 字符串转数字字符串转数字,默认只处理由纯数字组成的字符串。 str='12345678'str2='3.14'int1=int(str)float1=float(str2)print(int1)print(type(int1))print(float1)print(type(float1))-----------------输出结果如下:12345678<class'int'>3.14<class'float'> 数字转字符串代码如下 ...

  X7HGjGJ7MG9G   2023年11月02日   62   0   0 字符串转数字字符串元组