Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python string [::-1]

In [1]: string = "Howdy doody"

In [2]: string[::]
Out[2]: 'Howdy doody'

In [3]: string[::-1]
Out[3]: 'ydood ydwoH'

In [4]: string[0:]    
Out[4]: 'Howdy doody'

In [5]: string[0::-1]
Out[5]: 'H'     # what up with this?

In [6]: string[:len(string)]
Out[6]: 'Howdy doody'

In [7]: string[:len(string):-1]
Out[7]: ''     # what up with this too?

In [8]: string[0:len(string)]
Out[8]: 'Howdy doody'

In [9]: string[0:len(string):-1]
Out[9]: ''    # And what up here too.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #string
ADD COMMENT
Topic
Name
3+8 =