Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. >>> with open('input.txt', 'illegal') as f:
  2. ... for line in f:
  3. ... print line
  4. ...
  5. Traceback (most recent call last):
  6. File "<stdin>", line 1, in <module>
  7. ValueError: mode string must begin with one of 'r', 'w', 'a' or 'U', not 'illegal'
  8.  
  9. >>> with open('input.txt', 'rock&roll') as f:
  10. ... for line in f:
  11. ... print line
  12. ...
  13. 1
  14.  
  15. 2
  16.  
  17. 3
  18.  
  19. >>> with open('input.txt', 'rock&roll') as f:
  20. ... for line in f:
  21. ... print(line)
  22. ...
  23. Traceback (most recent call last):
  24. File "<stdin>", line 1, in <module>
  25. ValueError: invalid mode: 'rock&roll'
  26. >>> with open('input.txt', 'illegal') as f:
  27. ... for line in f:
  28. ... print(line)
  29. ...
  30. Traceback (most recent call last):
  31. File "<stdin>", line 1, in <module>
  32. ValueError: invalid mode: 'illegal'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement