博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python FileError
阅读量:6146 次
发布时间:2019-06-21

本文共 3662 字,大约阅读时间需要 12 分钟。

1 >>> ls1=["nihia"]  2 >>> ls1  3 ['nihia']  4 >>> ls1.pop()  5 'nihia'  6 >>> ls1.append("sssss")  7 >>> ls1  8 ['sssss']  9 >>> assert len(ls1)>0 10 >>> ls1.pop() 11 'sssss' 12 >>> assert len(ls1)>0 13  14 Traceback (most recent call last): 15   File "
", line 1, in
16 assert len(ls1)>0 17 AssertionError 18 >>> 19 >>> ls1.fishc 20 21 Traceback (most recent call last): 22 File "
", line 1, in
23 ls1.fishc 24 AttributeError: 'list' object has no attribute 'fishc' 25 >>> 26 >>> ms1[3] 27 28 Traceback (most recent call last): 29 File "
", line 1, in
30 ms1[3] 31 NameError: name 'ms1' is not defined 32 >>> ls1[3] 33 34 Traceback (most recent call last): 35 File "
", line 1, in
36 ls1[3] 37 IndexError: list index out of range 38 >>> 39 >>> dict1={'one':1 ,'two':2} 40 >>> dict1['one'] 41 1 42 >>> dict1['four'] 43 44 Traceback (most recent call last): 45 File "
", line 1, in
46 dict1['four'] 47 KeyError: 'four' 48 >>> dixt1.get('four') 49 50 Traceback (most recent call last): 51 File "
", line 1, in
52 dixt1.get('four') 53 NameError: name 'dixt1' is not defined 54 >>> dict1.get('four') 55 >>> dict1.get('two') 56 2 57 >>> 1+'1' 58 59 Traceback (most recent call last): 60 File "
", line 1, in
61 1+'1' 62 TypeError: unsupported operand type(s) for +: 'int' and 'str' 63 >>> 5/0 64 65 Traceback (most recent call last): 66 File "
", line 1, in
67 5/0 68 ZeroDivisionError: integer division or modulo by zero 69 >>> 70 >>> 71 >>> 72 >>> 73 >>> ================================ RESTART ================================ 74 >>> 75 76 Traceback (most recent call last): 77 File "/tmp/guest-WX48w4/文档/py1.py", line 2, in
78 file_name=open('myname') 79 IOError: [Errno 2] No such file or directory: 'myname' 80 >>> ================================ RESTART ================================ 81 >>> 82 83 Traceback (most recent call last): 84 File "/tmp/guest-WX48w4/文档/py1.py", line 2, in
85 file_name=open('myname.txt') 86 IOError: [Errno 2] No such file or directory: 'myname.txt' 87 >>> ================================ RESTART ================================ 88 >>> 89 wrong 90 [Errno 2] No such file or directory: 'myname.txt' 91 >>> ================================ RESTART ================================ 92 >>> 93 wrong 94 [Errno 2] No such file or directory: 'myname.txt' 95 >>> ================================ RESTART ================================ 96 >>> 97 98 Traceback (most recent call last): 99 File "/tmp/guest-WX48w4/文档/py1.py", line 2, in
100 name=a+'1'101 NameError: name 'a' is not defined102 >>> ================================ RESTART ================================103 >>> 104 wrong105 unsupported operand type(s) for +: 'int' and 'str'106 >>> ================================ RESTART ================================107 >>> 108 109 Traceback (most recent call last):110 File "/tmp/guest-WX48w4/文档/py1.py", line 2, in
111 int ('abc')112 ValueError: invalid literal for int() with base 10: 'abc'113 >>> ================================ RESTART ================================114 >>> 115 116 Traceback (most recent call last):117 File "/tmp/guest-WX48w4/文档/py1.py", line 5, in
118 print (file_name.read())119 NameError: name 'file_name' is not defined120 >>> 1/0121 122 Traceback (most recent call last):123 File "
", line 1, in
124 1/0125 ZeroDivisionError: integer division or modulo by zero126 >>> raise 1/0127 128 Traceback (most recent call last):129 File "
", line 1, in
130 raise 1/0131 ZeroDivisionError: integer division or modulo by zero132 >>>

转载于:https://www.cnblogs.com/wangsicongde/p/7599146.html

你可能感兴趣的文章
2016总结
查看>>
指令周期 机器周期 状态周期 振荡时钟周期(时钟周期)(转)
查看>>
恶意程序入侵 dbuspm-session 发现了新的方法制这种恶意程序
查看>>
JavaWeb应用出现HTTP 500-Unable to compile class for JSP 错误 的解决
查看>>
六种微服务架构的设计模式
查看>>
Unity Remote 5 使用
查看>>
swift开发多线程篇 - 多线程基础
查看>>
《ArcGIS Runtime SDK for Android开发笔记》——(5)、基于Android Studio构建ArcGIS Android开发环境(离线部署)...
查看>>
Selenium2+python自动化37-爬页面源码(page_source)
查看>>
pm2-web
查看>>
011-Spring Boot 运行流程分析SpringApplication.run
查看>>
[解决方案]sql server复制需要有实际的服务器名称才能连接到服务器
查看>>
用yarn替代npm
查看>>
ReSharper2017.3的列对齐、排版格式、列对齐错误的修复
查看>>
BZOJ3273 : liars
查看>>
mysql开发之---每日一得01
查看>>
Java基础-MySQL数据库扫盲篇
查看>>
Echarts关于仪表盘
查看>>
php实现求数组中出现次数超过一半的数字(isset($arr[$val]))(取不同数看剩)(排序取中)...
查看>>
(转)创业的注意事项
查看>>