Clean-up example code: remove string module and backticks.

This commit is contained in:
Raymond Hettinger 2003-09-22 06:25:10 +00:00
parent 9832613beb
commit 1e80359733
1 changed files with 2 additions and 3 deletions

View File

@ -264,7 +264,6 @@ processing of the \rfc{822} headers. In particular, the `To' and
\begin{verbatim} \begin{verbatim}
import smtplib import smtplib
import string
def prompt(prompt): def prompt(prompt):
return raw_input(prompt).strip() return raw_input(prompt).strip()
@ -275,7 +274,7 @@ print "Enter message, end with ^D (Unix) or ^Z (Windows):"
# Add the From: and To: headers at the start! # Add the From: and To: headers at the start!
msg = ("From: %s\r\nTo: %s\r\n\r\n" msg = ("From: %s\r\nTo: %s\r\n\r\n"
% (fromaddr, string.join(toaddrs, ", "))) % (fromaddr, ", ".join(toaddrs)))
while 1: while 1:
try: try:
line = raw_input() line = raw_input()
@ -285,7 +284,7 @@ while 1:
break break
msg = msg + line msg = msg + line
print "Message length is " + `len(msg)` print "Message length is " + repr(len(msg))
server = smtplib.SMTP('localhost') server = smtplib.SMTP('localhost')
server.set_debuglevel(1) server.set_debuglevel(1)