Python String Program
Categories: Python
str = 'Hello Priya!'
print str # Prints complete string
print str[0] # Prints first character of the string
print str[2:5] # Prints characters starting from 3rd to 5th
print str[2:] # Prints string starting from 3rd character
print str * 2 # Prints string two times
print str + "TEST" # Prints concatenated string
This will produce the following result −
Hello Priya!
H
llo
llo Priya!
Hello Priya!Hello Priya!
Hello Priya!TEST