Re: [Tutor] Getting multi-line input from user

2009-01-07 Thread wormwood_3
From: Alan Gauld To: tutor@python.org Sent: Wednesday, January 7, 2009 3:58:18 AM Subject: Re: [Tutor] Getting multi-line input from user "Andre Engels" wrote > The newline character is written \n in Python, so if you replace > > ' &#

Re: [Tutor] Getting multi-line input from user

2009-01-07 Thread Alan Gauld
"Andre Engels" wrote The newline character is written \n in Python, so if you replace ' '.join(user_input) by '\n'.join(user_input) Yep, that's better than my suggestion of adding the \n at append time. :-) Alan G. ___ Tutor maillist - Tu

Re: [Tutor] Getting multi-line input from user

2009-01-07 Thread Alan Gauld
"wormwood_3" wrote On point 2, say I enter: Enter text, 'done' on its own line to quit: I am a sentence. I am another sentence. I am a new paragraph. done What I get out is: I am a sentence. I am another sentence. I am a new paragraph. But that just shows the double new lines of my new par

Re: [Tutor] Getting multi-line input from user

2009-01-06 Thread Andre Engels
On Wed, Jan 7, 2009 at 4:31 AM, wormwood_3 wrote: > On point 2, say I enter: > Enter text, 'done' on its own line to quit: > I am a sentence. I am another sentence. > > I am a new paragraph. > done > > What I get out is: > I am a sentence. I am another sentence. I am a new paragraph. > > But tha

Re: [Tutor] Getting multi-line input from user

2009-01-06 Thread wormwood_3
>>> For starters you can simplify things a lot: >>> >>> user_input = [] >>> entry = raw_input("Enter text, 'done' on its own line to quit: \n") >>> while entry != "done": >>>user_input.append(entry) >>>entry = raw_input("") >>> user_input = ' '.join(user_input) >>> print user_input >>> >>

Re: [Tutor] Getting multi-line input from user

2009-01-06 Thread bob gailer
wormwood_3 wrote: Hello everyone, I'd like to prompt the user for input and get back multiple lines, for example if someone wanted to enter a few paragraphs. Then I'd like to be able to print their input out and preserve formatting. Here's what I have so far: control = True user_input = []

[Tutor] Getting multi-line input from user

2009-01-06 Thread wormwood_3
Hello everyone, I'd like to prompt the user for input and get back multiple lines, for example if someone wanted to enter a few paragraphs. Then I'd like to be able to print their input out and preserve formatting. Here's what I have so far: control = True user_input = [] while control: if