tags:

views:

156

answers:

5
print 'xxx' > 'ssaww'

it print 'true'

who can give me a clear example .

thanks

A: 

to order strings syntactically (e.g. alphabetically).

Stefano Borini
+4  A: 

In python strings are ordered lexicographically.

Geoff Reedy
+5  A: 

Just like in math, > compares two operands and returns True if the left operand is greater than the right, otherwise False.

Ignacio Vazquez-Abrams
+3  A: 

you can test it out on the interpreter

>>> 'xxx'>'yyy'  #first character 'x' is less than first character 'y', so false
False
>>> 'xxx'>'xyy' 
False
>>> 'xyy'>'xyx' #3rd character 'y' is greater than 3rd character 'x', so true
True
ghostdog74
A: 

It can do y>x>z as a nicer way to say y>x and x>z.

As others have mentioned its a simple greater-than comparison (in your case for strings).

Roman A. Taycher