Created
January 3, 2018 05:23
-
-
Save laixintao/5cf1a662449ef56879b2ebcac189643f 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
~/Downloads ipython | |
Python 3.6.3 (default, Nov 3 2017, 14:41:25) | |
Type 'copyright', 'credits' or 'license' for more information | |
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help. | |
In [1]: i = 'foo' | |
In [2]: [i for i in range(10)] | |
Out[2]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
In [3]: i | |
Out[3]: 'foo' | |
In [4]: for i in range(10): | |
...: print(i) | |
...: | |
0 | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
In [5]: i | |
Out[5]: 9 | |
In [6]: exit | |
~/Downloads python2.7 | |
Python 2.7.14 (default, Sep 25 2017, 09:54:19) | |
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> i = 'foo' | |
>>> [i for i in range(10)] | |
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
>>> i | |
9 | |
>>> i = 'foo' | |
>>> for i in range(10): | |
... print(i) | |
... | |
0 | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
>>> i | |
9 | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment