Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8d5c392

Browse files
committed
Remove all definitions of raw_input() that were still scattered throughout the docs
from the time where there was neither input() nor raw_input().
1 parent 2b1c592 commit 8d5c392

6 files changed

Lines changed: 8 additions & 37 deletions

File tree

Doc/library/crypt.rst

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,8 @@ A simple example illustrating typical use::
4747

4848
import crypt, getpass, pwd
4949

50-
def raw_input(prompt):
51-
import sys
52-
sys.stdout.write(prompt)
53-
sys.stdout.flush()
54-
return sys.stdin.readline()
55-
5650
def login():
57-
username = raw_input('Python login:')
51+
username = input('Python login:')
5852
cryptedpasswd = pwd.getpwnam(username)[1]
5953
if cryptedpasswd:
6054
if cryptedpasswd == 'x' or cryptedpasswd == '*':

Doc/library/smtplib.rst

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,8 @@ example doesn't do any processing of the :rfc:`822` headers. In particular, the
306306

307307
import smtplib
308308

309-
def raw_input(prompt):
310-
import sys
311-
sys.stdout.write(prompt)
312-
sys.stdout.flush()
313-
return sys.stdin.readline()
314-
315309
def prompt(prompt):
316-
return raw_input(prompt).strip()
310+
return input(prompt).strip()
317311

318312
fromaddr = prompt("From: ")
319313
toaddrs = prompt("To: ").split()
@@ -324,7 +318,7 @@ example doesn't do any processing of the :rfc:`822` headers. In particular, the
324318
% (fromaddr, ", ".join(toaddrs)))
325319
while True:
326320
try:
327-
line = raw_input()
321+
line = input()
328322
except EOFError:
329323
break
330324
if not line:

Doc/library/telnetlib.rst

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,16 +211,10 @@ Telnet Example
211211
A simple example illustrating typical use::
212212

213213
import getpass
214-
import sys
215214
import telnetlib
216215

217-
def raw_input(prompt):
218-
sys.stdout.write(prompt)
219-
sys.stdout.flush()
220-
return sys.stdin.readline()
221-
222216
HOST = "localhost"
223-
user = raw_input("Enter your remote account: ")
217+
user = input("Enter your remote account: ")
224218
password = getpass.getpass()
225219

226220
tn = telnetlib.Telnet(HOST)

Doc/library/termios.rst

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,6 @@ technique using a separate :func:`tcgetattr` call and a :keyword:`try` ...
9090
:keyword:`finally` statement to ensure that the old tty attributes are restored
9191
exactly no matter what happens::
9292

93-
def raw_input(prompt):
94-
import sys
95-
sys.stdout.write(prompt)
96-
sys.stdout.flush()
97-
return sys.stdin.readline()
98-
9993
def getpass(prompt = "Password: "):
10094
import termios, sys
10195
fd = sys.stdin.fileno()
@@ -104,7 +98,7 @@ exactly no matter what happens::
10498
new[3] = new[3] & ~termios.ECHO # lflags
10599
try:
106100
termios.tcsetattr(fd, termios.TCSADRAIN, new)
107-
passwd = raw_input(prompt)
101+
passwd = input(prompt)
108102
finally:
109103
termios.tcsetattr(fd, termios.TCSADRAIN, old)
110104
return passwd

Doc/library/traceback.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ module. ::
143143
import sys, traceback
144144

145145
def run_user_code(envdir):
146-
source = raw_input(">>> ")
146+
source = input(">>> ")
147147
try:
148148
exec(source, envdir)
149149
except:

Doc/tutorial/stdlib2.rst

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,11 @@ Template subclasses can specify a custom delimiter. For example, a batch
104104
renaming utility for a photo browser may elect to use percent signs for
105105
placeholders such as the current date, image sequence number, or file format::
106106

107-
>>> import time, os.path, sys
108-
>>> def raw_input(prompt):
109-
... sys.stdout.write(prompt)
110-
... sys.stdout.flush()
111-
... return sys.stdin.readline()
112-
...
107+
>>> import time, os.path
113108
>>> photofiles = ['img_1074.jpg', 'img_1076.jpg', 'img_1077.jpg']
114109
>>> class BatchRename(Template):
115110
... delimiter = '%'
116-
>>> fmt = raw_input('Enter rename style (%d-date %n-seqnum %f-format): ')
111+
>>> fmt = input('Enter rename style (%d-date %n-seqnum %f-format): ')
117112
Enter rename style (%d-date %n-seqnum %f-format): Ashley_%n%f
118113

119114
>>> t = BatchRename(fmt)

0 commit comments

Comments
 (0)