[Tutor] boolean raw_input

Bernard Lebel python at bernardlebel.com
Thu Aug 19 09:07:31 CEST 2004


Thanks Alan.

I thought you could get a checkbox inside a raw_input call.
Any suggestion in that regard will be welcomed :-)


Bernard


----- Original Message ----- 
From: "Alan Gauld" <alan.gauld at blueyonder.co.uk>
To: "Bernard Lebel" <python at bernardlebel.com>; <tutor at python.org>
Sent: Thursday, August 19, 2004 12:32 AM
Subject: Re: [Tutor] boolean raw_input


> > Recently I saw on this list a bit of code that used a boolean
> expression
> > inside a raw_input call, and of course realized after I deleted the
> email
> > that I actually need that.
> 
> > If I remember correctly, it was something like:
> >
> > raw_input( 'text', [y/n] )
> 
> More, likely it was:
> 
> raw_input("text [y/n]")
> 
> ie the default values shown inside the prompt string.
> raw_input only takes one parameter, a prompt string.
> 
> The only way I can think of to use boolean expressions inside
> raw_input is to use a single input line to do two jobs. ie
> 
> value = raw_input(SomeTest() and "Sometest value:" or "Something
> else:")
> 
> Which does the same as:
> 
> if someTest():
>    value = raw_input("Sometest value:")
> else:
>    value = raw_input("Something else:")
> 
> Other than that I can't think what you mean.
> 
> Alan G.
> 
> 
> 


More information about the Tutor mailing list