[Tutor] How to print out multiple lines
Sun, 07 Jan 2001 13:30:24 -0800
Replying to my own post:
OK, it seems simple enough to accomplish this in the IDLE environment or at a
command line prompt:
>>> print '''Hello.
... How are you?
... Thanks for asking.'''
How are you?
Thanks for asking.
Just use triple quotes.
But, how do I accomplish something like this (here is a small SMTP script I
wrote for investigation):
import smtplib, string
servername=input("SMTP server name: ")
Fromaddress=input("From address: ")
Toaddress=input("To address: ")
MessageText=input("message text: ")
server.sendmail(Fromaddress, Toaddress, MessageText)
The above script will not allow MessageText to have multiple lines.
On Sun, 07 Jan 2001 13:05:55 -0800, Sheila King <email@example.com> wrote
about [Tutor] How to print out multiple lines:
:OK, I've been to python.org, I've gone through Guido's tutorial, I've looked
:at a few modules.
:I've even been able to sort of send mails through a SMTP server and retrieve
:articles off of an NNTP server. So I have *some* clue.
:But apparently not enough.
:How can I get an interactive Python session to read in something like this:
:How are you?
:Thanks for asking.
:So that the newline characters are preserved, and when I print them out, they
:are printed to the screen?
:When I retrieved the news articles off the NNTP server, for instance, the
:message body was just one big long string, with some numeric code for the
:newlines. It was just a mess to read.