Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> with open('input.txt', 'illegal') as f:
- ... for line in f:
- ... print line
- ...
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- ValueError: mode string must begin with one of 'r', 'w', 'a' or 'U', not 'illegal'
- >>> with open('input.txt', 'rock&roll') as f:
- ... for line in f:
- ... print line
- ...
- 1
- 2
- 3
- >>> with open('input.txt', 'rock&roll') as f:
- ... for line in f:
- ... print(line)
- ...
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- ValueError: invalid mode: 'rock&roll'
- >>> with open('input.txt', 'illegal') as f:
- ... for line in f:
- ... print(line)
- ...
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- ValueError: invalid mode: 'illegal'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement