Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

check strings last letter python

sample_str = 'Sample String'
# Get last character of string i.e. char at index position -1
last_char = sample_str[-1]
 
print('Last character : ', last_char)
# Output
Last charater : g
Comment

get last n characters of string python

last_n_chars = -4
mystr = "abcdefghijkl"
mystr[last_n_chars:]
# 'ijkl'
Comment

find a character in a string python last

s='Hello world'
s.rfind('l')
Comment

PREVIOUS NEXT
Code Example
Python :: python string match ignore case 
Python :: pandas read first column as index 
Python :: python cv2 get image shape 
Python :: random id python 
Python :: ImportError: No module named flask 
Python :: pandas shift column down 
Python :: measure cell execution time in jupyter notebook 
Python :: add age categories pandas dataframe 
Python :: how do i print a list line by line in python 
Python :: concatenate data vertically python 
Python :: sort dictionary by value python 
Python :: password generator in python 
Python :: how to check if given number is binary in pytho 
Python :: python dictionary comprehension 
Python :: create an empty dataframe 
Python :: index of max value of sequence python 
Python :: modify string in column pandas 
Python :: webbrowser python 
Python :: tkinter messagebox 
Python :: mutable and immutable in python 
Python :: Python program to check Co-Prime Number 
Python :: change plot size matplotlib 
Python :: python count number of unique elements in a list 
Python :: conda env 
Python :: difference of two set in python 
Python :: change colorbar size and place python 
Python :: opencv dilate 
Python :: assign python 
Python :: python print percent sign 
Python :: mouse bottom in pygame 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =