Bazza LXF regular

Joined: Sat Mar 21, 2009 11:16 am Posts: 1381 Location: Loughborough
|
Posted: Wed Aug 10, 2011 8:23 pm Post subject: "raw_input" For ALL Versions Of Python... |
|
|
Hi all...
A simple quicky...
Add these two lines to ANY python code from Python 1.4.0 to 3.2.x, and
have universal KB entry for ALL versions...
(C)2011, B.Walker, G0LCU...
Issued under the MIT licence.
<CODE>
import sys
if sys.version[0]=="3": raw_input=input
</CODE>
Test procedure below for Python 3.x.x...
| Code: |
Python 3.1.3 (r313:86834, Nov 28 2010, 10:01:07)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> if sys.version[0]=="3":
... raw_input=input
...
>>> test=raw_input("Some Prompt:- ")
Some Prompt:- qwertyuiop
>>> print(test)
qwertyuiop
>>>
|
_________________ 73...
Bazza, G0LCU...
Team AMIGA... |
|