T
T
TODO•SEC
Search…
Python2and3code.py
This snippet of code has been tested to work on Python 2 and Python 3 by employing the techniques detailed in the blog post "Python 2 vs Python 3".
This snippet of code has been tested to work on Python 2 and Python 3 by employing the techniques detailed in the blog post "Python 2 vs Python 3".
1
from __future__ import absolute_import, division, print_function
2
from pip._vendor.distlib.compat import raw_input
3
4
5
def get_input(prompt=''):
6
try:
7
line = raw_input(prompt)
8
except NameError:
9
x = input(prompt)
10
return line
11
12
13
x = get_input('Type : ')
14
15
print(x)
Copied!
Last modified 8d ago
Copy link