Created
October 16, 2014 18:47
-
-
Save josePhoenix/53a2e5acc49fe6d2cfd3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| In [5]: for i in range(10) + ['missing'] + range(11,50): | |
| ...: print float(i) | |
| ...: | |
| 0.0 | |
| 1.0 | |
| 2.0 | |
| 3.0 | |
| 4.0 | |
| 5.0 | |
| 6.0 | |
| 7.0 | |
| 8.0 | |
| 9.0 | |
| --------------------------------------------------------------------------- | |
| ValueError Traceback (most recent call last) | |
| <ipython-input-5-d62628a1bc7e> in <module>() | |
| 1 for i in range(10) + ['missing'] + range(11,50): | |
| ----> 2 print float(i) | |
| 3 | |
| ValueError: could not convert string to float: missing | |
| In [8]: %paste | |
| for i in range(10) + ['missing'] + range(11,50): | |
| try: | |
| print float(i) | |
| except: | |
| import code | |
| code.interact(local=locals()) | |
| ## -- End pasted text -- | |
| 0.0 | |
| 1.0 | |
| 2.0 | |
| 3.0 | |
| 4.0 | |
| 5.0 | |
| 6.0 | |
| 7.0 | |
| 8.0 | |
| 9.0 | |
| Python 2.7.8 (default, Oct 2 2014, 13:50:25) | |
| [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.51)] on darwin | |
| Type "help", "copyright", "credits" or "license" for more information. | |
| (InteractiveConsole) | |
| >>> print float(i) | |
| Traceback (most recent call last): | |
| File "<console>", line 1, in <module> | |
| ValueError: could not convert string to float: missing | |
| >>> print repr(i) | |
| 'missing' | |
| >>> ^D | |
| 11.0 | |
| 12.0 | |
| 13.0 | |
| 14.0 | |
| 15.0 | |
| 16.0 | |
| 17.0 | |
| 18.0 | |
| 19.0 | |
| 20.0 | |
| 21.0 | |
| 22.0 | |
| 23.0 | |
| 24.0 | |
| 25.0 | |
| 26.0 | |
| 27.0 | |
| 28.0 | |
| 29.0 | |
| 30.0 | |
| 31.0 | |
| 32.0 | |
| 33.0 | |
| 34.0 | |
| 35.0 | |
| 36.0 | |
| 37.0 | |
| 38.0 | |
| 39.0 | |
| 40.0 | |
| 41.0 | |
| 42.0 | |
| 43.0 | |
| 44.0 | |
| 45.0 | |
| 46.0 | |
| 47.0 | |
| 48.0 | |
| 49.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment