Python,我如何从字符串中构造这些变量整数

这个问题在这里已经有了答案:

  • 如何在Python中将字符串解析为float或int? 22个答案

  • 你不能在Python中声明类型,因为Python是一种动态类型的编程语言,比如Ruby,Smalltalk,Javascript等等。 动态语言有自己的优点和缺点,试图学习它们。

    int_number = int('99') # here you go as far as casting is concerned
    
    链接地址: http://www.djcxy.com/p/48439.html

    上一篇: Python, how do I make these variables integers from string

    下一篇: Converting to float for division and then convert back