On 16.02.2007 08:01, xiufeng liu wrote:
> Hi, all,
> 
> In python if there is any similar way like in Java, or C++ to express
> the following:
> str = (a>b?"Yes":"NO")
> 
> 
> thanks!

In Python 2.5 you can do the following (untested):

str = "Yes" if a>b else "No"

See: http://docs.python.org/whatsnew/pep-308.html

HTH,
Wolfram

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to