Accessing string as an array in Python

Accessing string as an array in Python

Instructor-svgAl-Mamun Sarkar
Mar 24 , 2020

Accessing string as an array in Python Programming. 

str = "Bangladesh"
print(str[0])
print(str[1])

# Sub string
print(str[1:6])
print(str[:3])
print(str[4:])

Output:

B
a
angla
Ban
ladesh

 

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram