1.说明
Python long() 函数将数字或字符串转换为一个长整型。
2.语法
class long(x, base=10)
3.参数
x -- 字符串或数字。
base -- 可选,进制数,默认十进制。
4.返回值
返回长整型数。
5.实例
def _is_integer(x): """Determine whether some object ``x`` is an integer type (int, long, etc). This is part of the ``fixes`` module, since Python 3 removes the long datatype, we have to check the version major. Parameters ---------- x : object The item to assess whether is an integer. Returns ------- bool True if ``x`` is an integer type """ return (not isinstance(x, (bool, np.bool))) and \ isinstance(x, (numbers.Integral, int, np.int, np.long, long)) # no long type in python 3
以上就是python long函数在数字和字符串转化方面的应用,小伙伴们有没有成功转换成长整型呢,一定要按照上方小编的代码哦~
(推荐操作系统:windows7系统、Python 3.9.1,DELL G3电脑。)
Copyright © 2019- zicool.com 版权所有 湘ICP备2023022495号-2
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务