Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python substring from end

# string [start:end:step]
string = "freeCodeCamp"
print(string[0:len(string)-1])		# freeCodeCam
print(string[0:5])		            # freeC
print(string[2:6])		            # eeCo
print(string[-1])		            # p
print(string[-5:])		            # eCamp
print(string[1:-4])                 # reeCode
print(string[-5:-2])	            # eCa
print(string[::2])		            # feCdCm
Comment

PREVIOUS NEXT
Code Example
Python :: python string cut last character 
Python :: finding the maximum value in a list python 
Python :: python count of letters in string 
Python :: change forms labels django 
Python :: Python Tkinter Button Widget 
Python :: check auth user django 
Python :: fetch row where column is missing pandas 
Python :: delete row if contains certain text pandas 
Python :: split string into groups of 3 chars python 
Python :: python 2.7 datetime to timestamp 
Python :: get input on same line python 
Python :: file uploads django 
Python :: randint() 
Python :: encrypt password with sha512 + python 
Python :: for enumerate python 
Python :: find next multiple of 5 python 
Python :: python change directory to previous 
Python :: how to make text to speech in python 
Python :: get UTC time for IST time python 
Python :: pandas find all rows not null 
Python :: xls in python 
Python :: serialize keras model 
Python :: Flask command db migrate 
Python :: how to combine strings python 
Python :: no module named googlesearch 
Python :: hugingface ner 
Python :: django admin create project 
Python :: python cast to float 
Python :: win64pyinstaller 
Python :: serialization in django 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =