diff options
author | Georg Brandl <georg@python.org> | 2007-12-02 22:48:17 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-12-02 22:48:17 (GMT) |
commit | 8d5c39240e2717f751d4cba34baf4493bdcf0985 (patch) | |
tree | e261b11315d26599896ebb515d204206852d604d /Doc | |
parent | 2b1c592d22c16f3cb810625168ed1ce0c806d004 (diff) | |
download | cpython-8d5c39240e2717f751d4cba34baf4493bdcf0985.zip cpython-8d5c39240e2717f751d4cba34baf4493bdcf0985.tar.gz cpython-8d5c39240e2717f751d4cba34baf4493bdcf0985.tar.bz2 |
Remove all definitions of raw_input() that were still scattered throughout the docs
from the time where there was neither input() nor raw_input().
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/crypt.rst | 8 | ||||
-rw-r--r-- | Doc/library/smtplib.rst | 10 | ||||
-rw-r--r-- | Doc/library/telnetlib.rst | 8 | ||||
-rw-r--r-- | Doc/library/termios.rst | 8 | ||||
-rw-r--r-- | Doc/library/traceback.rst | 2 | ||||
-rw-r--r-- | Doc/tutorial/stdlib2.rst | 9 |
6 files changed, 8 insertions, 37 deletions
diff --git a/Doc/library/crypt.rst b/Doc/library/crypt.rst index 8840fc7..7e0cb9c 100644 --- a/Doc/library/crypt.rst +++ b/Doc/library/crypt.rst @@ -47,14 +47,8 @@ A simple example illustrating typical use:: import crypt, getpass, pwd - def raw_input(prompt): - import sys - sys.stdout.write(prompt) - sys.stdout.flush() - return sys.stdin.readline() - def login(): - username = raw_input('Python login:') + username = input('Python login:') cryptedpasswd = pwd.getpwnam(username)[1] if cryptedpasswd: if cryptedpasswd == 'x' or cryptedpasswd == '*': diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst index 0653a50..790cacb 100644 --- a/Doc/library/smtplib.rst +++ b/Doc/library/smtplib.rst @@ -306,14 +306,8 @@ example doesn't do any processing of the :rfc:`822` headers. In particular, the import smtplib - def raw_input(prompt): - import sys - sys.stdout.write(prompt) - sys.stdout.flush() - return sys.stdin.readline() - def prompt(prompt): - return raw_input(prompt).strip() + return input(prompt).strip() fromaddr = prompt("From: ") toaddrs = prompt("To: ").split() @@ -324,7 +318,7 @@ example doesn't do any processing of the :rfc:`822` headers. In particular, the % (fromaddr, ", ".join(toaddrs))) while True: try: - line = raw_input() + line = input() except EOFError: break if not line: diff --git a/Doc/library/telnetlib.rst b/Doc/library/telnetlib.rst index 5cfca9a..7f08e70 100644 --- a/Doc/library/telnetlib.rst +++ b/Doc/library/telnetlib.rst @@ -211,16 +211,10 @@ Telnet Example A simple example illustrating typical use:: import getpass - import sys import telnetlib - def raw_input(prompt): - sys.stdout.write(prompt) - sys.stdout.flush() - return sys.stdin.readline() - HOST = "localhost" - user = raw_input("Enter your remote account: ") + user = input("Enter your remote account: ") password = getpass.getpass() tn = telnetlib.Telnet(HOST) diff --git a/Doc/library/termios.rst b/Doc/library/termios.rst index 695faad..54fb065 100644 --- a/Doc/library/termios.rst +++ b/Doc/library/termios.rst @@ -90,12 +90,6 @@ technique using a separate :func:`tcgetattr` call and a :keyword:`try` ... :keyword:`finally` statement to ensure that the old tty attributes are restored exactly no matter what happens:: - def raw_input(prompt): - import sys - sys.stdout.write(prompt) - sys.stdout.flush() - return sys.stdin.readline() - def getpass(prompt = "Password: "): import termios, sys fd = sys.stdin.fileno() @@ -104,7 +98,7 @@ exactly no matter what happens:: new[3] = new[3] & ~termios.ECHO # lflags try: termios.tcsetattr(fd, termios.TCSADRAIN, new) - passwd = raw_input(prompt) + passwd = input(prompt) finally: termios.tcsetattr(fd, termios.TCSADRAIN, old) return passwd diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index 9b96743..ca8aea3 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -143,7 +143,7 @@ module. :: import sys, traceback def run_user_code(envdir): - source = raw_input(">>> ") + source = input(">>> ") try: exec(source, envdir) except: diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst index 17fb867..4e8d37e 100644 --- a/Doc/tutorial/stdlib2.rst +++ b/Doc/tutorial/stdlib2.rst @@ -104,16 +104,11 @@ Template subclasses can specify a custom delimiter. For example, a batch renaming utility for a photo browser may elect to use percent signs for placeholders such as the current date, image sequence number, or file format:: - >>> import time, os.path, sys - >>> def raw_input(prompt): - ... sys.stdout.write(prompt) - ... sys.stdout.flush() - ... return sys.stdin.readline() - ... + >>> import time, os.path >>> photofiles = ['img_1074.jpg', 'img_1076.jpg', 'img_1077.jpg'] >>> class BatchRename(Template): ... delimiter = '%' - >>> fmt = raw_input('Enter rename style (%d-date %n-seqnum %f-format): ') + >>> fmt = input('Enter rename style (%d-date %n-seqnum %f-format): ') Enter rename style (%d-date %n-seqnum %f-format): Ashley_%n%f >>> t = BatchRename(fmt) |