Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

string slice python

# Python program to demonstrate
# string slicing
  
# String slicing 
String ='ASTRING'
  
# Using indexing sequence
print(String[:3])
print(String[1:5:2])
print(String[-1:-12:-2])
  
# Prints string in reverse 
print("
Reverse String")
print(String[::-1])

#AST
#SR
#GITA

#Reverse String
#GNIRTSA
Source by www.howtouselinux.com #
 
PREVIOUS NEXT
Tagged: #string #slice #python
ADD COMMENT
Topic
Name
6+6 =