python字符串跟整型互转print ("整型:",int(50))
a=int(50)
print("整型:",a)
numStr = "50";字符串长度是整型吗
print ("字符串:",type(numStr))
convertedInt = int(numStr);
print("字符串转换为整型:",convertedInt)
convertedstr=str(a)
print("整型转换为字符串:",convertedInt)
输出结果:
C:\Python3. D:/15期/day04/day04daima/7.py
整型: 50
整型: 50
字符串: <class 'str'>
字符串转换为整型: 50
整型转换为字符串: 50
Process finished with exit code 0

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。