How to print substring from a string in Python

1 Answer

0 votes
s = "c++ c php python golang python java"
  
index = 6

print(s[0: 9])

print(s[4: 11])

print(s[-4:])

print(s[4: -5])

  
    
   
'''
run:
 
c++ c php
c php p
java
c php python golang python
   
'''
 

 



answered Oct 24, 2020 by avibootz
...