[Tutor] using the loop function while another

Alan Gauld alan.gauld at btinternet.com
Wed Oct 10 09:37:20 CEST 2012

On 10/10/12 02:14, eryksun wrote:

>> another=input('Do you have another book to order for this student?',
>>                '\nEnter y for yes: ')
> Remove the comma, and this will parse correctly.

Oops, yes good catch, don't know where that came from.

>> another=input('''
>>                Do you have another book to order for this student?
>>                Enter y for yes: ''')
> This retains the leading spaces. You can use textwrap.dedent() to remove them:

I intended the spaces but didn't know about textwrap let alone dedent().
You learn something new every day! :-)

Alan G
Author of the Learn to Program web site

More information about the Tutor mailing list