How to Get Last Word from String Using Python?

Hello friends Today, through this tutorial, I will tell you how to get the last word from the value of any string by python. So let’s go.

Extract Last Word from String Using Python, Fetch Last Word from String by Python Program, Get Last Word from String in Python

It is very easy to get his last word from string via python. You are given below in a very easy way. You can get the last word of string by adding this code to your file.

my_str = "How are you Expertsphp"
words = my_str.split()
print(words[-1]) // Expertsphp