Guest User

Untitled

a guest
Jul 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. >>> try:
  2. ... x = int("a lot")
  3. ... except items["error"] as e:
  4. ... # Same as except ValueError as e
  5. ... print("Couldn't convert")
  6.  
  7. >>> try: ... x=int("a lot") File "<stdin>", line 2 x=int("a lot")
  8. ^
  9. IndentationError: expected an indented block
  10.  
  11. >>> items = {}
  12. >>> items["error"] = ValueError
  13. >>> try:
  14. ... x = int("a lot")
  15. ... except items["error"] as e:
  16. ... print "Couldn't convert"
  17. ...
  18. Couldn't convert
  19.  
  20. >>> try:
  21. ... x = int("a lot")
  22. ... except items["error"] as e:
  23. ... print("Couldn't convert")
Add Comment
Please, Sign In to add comment