GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — python_reference/python2_vs_3_version_info.py at master · jeffreywugz/python_reference Expand file tree/ Copy pathpython2_vs_3_version_info.pyMore file actions 24 lines (20 loc) · 494 Bytes / Copy pathpython2_vs_3_version_info.pyFile metadata and controls24 lines (20 loc) · 494 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 # Sebastian Raschka 04/10/2014 import sys def give_letter(word): for letter in word: yield letter if sys.version_info[0] == 3: print('executed in Python 3.x') test = give_letter('Hello') print(next(test)) print('in for-loop:') for l in test: print(l) # if Python 2.x if sys.version_info[0] == 2: print('executed in Python 2.x') test = give_letter('Hello') print(test.next()) print('in for-loop:') for l in test: print(l) |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |