Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python slice string

name = "dx4iot"
print(name[0:]) #output: dx4iot
print(name[0:3]) #output: dx4
#==== reverse a string ====#
print(name[::-1]) #output: toi4xd
print(name[0:6:2]) #output: d4o
print(name[-4:-1]) #output: 4io
Source by www.py4e.com #
 
PREVIOUS NEXT
Tagged: #python #slice #string
ADD COMMENT
Topic
Name
6+8 =