zoukankan      html  css  js  c++  java
  • python FileError

    复制代码
      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 "<pyshell#38>", line 1, in <module>
     16     assert len(ls1)>0
     17 AssertionError
     18 >>> 
     19 >>> ls1.fishc
     20 
     21 Traceback (most recent call last):
     22   File "<pyshell#40>", line 1, in <module>
     23     ls1.fishc
     24 AttributeError: 'list' object has no attribute 'fishc'
     25 >>> 
     26 >>> ms1[3]
     27 
     28 Traceback (most recent call last):
     29   File "<pyshell#42>", line 1, in <module>
     30     ms1[3]
     31 NameError: name 'ms1' is not defined
     32 >>> ls1[3]
     33 
     34 Traceback (most recent call last):
     35   File "<pyshell#43>", line 1, in <module>
     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 "<pyshell#47>", line 1, in <module>
     46     dict1['four']
     47 KeyError: 'four'
     48 >>> dixt1.get('four')
     49 
     50 Traceback (most recent call last):
     51   File "<pyshell#48>", line 1, in <module>
     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 "<pyshell#51>", line 1, in <module>
     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 "<pyshell#52>", line 1, in <module>
     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 <module>
     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 <module>
     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 <module>
    100     name=a+'1'
    101 NameError: name 'a' is not defined
    102 >>> ================================ RESTART ================================
    103 >>> 
    104 wrong
    105 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 <module>
    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 <module>
    118     print (file_name.read())
    119 NameError: name 'file_name' is not defined
    120 >>> 1/0
    121 
    122 Traceback (most recent call last):
    123   File "<pyshell#57>", line 1, in <module>
    124     1/0
    125 ZeroDivisionError: integer division or modulo by zero
    126 >>> raise 1/0
    127 
    128 Traceback (most recent call last):
    129   File "<pyshell#58>", line 1, in <module>
    130     raise 1/0
    131 ZeroDivisionError: integer division or modulo by zero
    132 >>> 
    复制代码
  • 相关阅读:
    Mysql String Functions
    Array JSON
    $(document).ready vs $(window).load vs window.onload
    jquery,返回到顶部按钮
    html5 教程网站
    js,replace() 和 正则表达式(regular expression)
    设置 textarea 默认滑动到底部
    工作常用英语单词整理2
    工作常用英语单词整理1
    javascript,jquery代码规范
  • 原文地址:https://www.cnblogs.com/wangsicongde/p/7599146.html
Copyright © 2011-2022 走看看