invert the order of a string

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Mon Feb 13 21:47:51 EST 2006


rtilley a écrit :
> s = list('some_random_string')
> print s
> s.reverse()
> print s
> s = ''.join(s)
> print s
> 
> Surely there's a better way to do this, right?

print 'some_random_string'[::-1]



More information about the Python-list mailing list