ValueError: invalid literal for int() with base 10: '7.8000000e+02'
来源:互联网 发布:去马赛克软件下载 编辑:程序博客网 时间:2024/06/08 17:00
ValueError: invalid literal for int() with base 10: '7.8000000e+02'
1. ValueError 1
number_string = "7.8000000e+02"number_value = int(number_string)
==>
/usr/bin/python2.7 /home/strong/PycharmProjects/crash_course/python_function/number_string.pyTraceback (most recent call last): File "/home/strong/PycharmProjects/crash_course/python_function/number_string.py", line 4, in <module> number_value = int(number_string)ValueError: invalid literal for int() with base 10: '7.8000000e+02'Process finished with exit code 1
Python int( ) 函数的输入字符串中可以包含数字字符和 + 、-符号,不能包含其它非数字字符。
2. example 1
number_string = "7.8000000e+02"float_value = float(number_string)int_value1 = int(float_value)int_value2 = int(float(number_string))print("float_value: " + str(float_value))print("int_value1: " + str(int_value1))print("int_value2: " + str(int_value2))
==>
/usr/bin/python2.7 /home/strong/PycharmProjects/crash_course/python_function/number_string.pyfloat_value: 780.0int_value1: 780int_value2: 780Process finished with exit code 0
3. example 2
number_string1 = "+99"number_string2 = "-99"int_value1 = int(number_string1)int_value2 = int(number_string2)print("int_value1: " + str(int_value1))print("int_value2: " + str(int_value2))
==>
/usr/bin/python2.7 /home/strong/PycharmProjects/crash_course/python_function/number_string.pyint_value1: 99int_value2: -99Process finished with exit code 0
阅读全文
0 0
- ValueError: invalid literal for int() with base 10: '7.8000000e+02'
- ValueError: invalid literal for int() with base 10
- ValueError: invalid literal for int() with base 10
- ValueError: invalid literal for int() with base 10: '2.0'
- Python debug ValueError: invalid literal for int() with base 10:
- ValueError: invalid literal for int() with base 10: ''
- ValueError: invalid literal for int() with base 10: '1127437398.85751'
- ValueError: invalid literal for int() with base 10: 'largeDoses'
- ValueError: invalid literal for int() with base 10: ' ' 文本转化为向量错误解决
- 用scrapy框架时,出现问题:ValueError: invalid literal for int() with base 10: 'dev0'
- repo init 报:ValueError: invalid literal for int() with base 10: '8 (Apple Git-58)'
- machine learning in action出现ValueError: invalid literal for int() with base 10: 'largeDoses'
- 完美解决ValueError: invalid literal for int() with base 10 错误问题
- Python debug —— invalid literal for int() with base 10
- 《机器学习实战》 2.1 小节 kNN 算法中 invalid literal for int() with base 10:‘largeDoses
- moviepy ValueError: Invalid value for quantizer: 'wu'
- ValueError: invalid \x escape
- [invalid literal/length code]
- 分别显示用float和double指数记数法所能表示的最大值和最小值 以一个最高有效位为1的二进制数字开始,用有符号右移操作符对其进行右移,直至所有二进制位都被移除为止,每移一位都要使用Integer
- Handler图片自动轮播
- JAVA-"abstract"与"接口(interface)"
- C++ 二叉树建立,遍历
- android 倒计时控件布局
- ValueError: invalid literal for int() with base 10: '7.8000000e+02'
- Android 第三方登录
- 7.ES6 变量的解构赋值 (Destructuring)
- MVP+RxJava+Retryfit+RecyclerView多条目展示
- 缺少的字符串-LintCode
- C++/C++11中命名空间(namespace)的使用
- HTML5游戏设计与制作
- 位运算总结即技巧
- 22.Struts2_CRUD操作(2)添加和修改