Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to check if a string ends with a substring python

inp = input("Enter file name: ")
if inp.endswith(".py"):
  print("Your file is a python file!")

# There are two examples here
# if the input ends with .py then inp.endswith(".py") will output True
# and prints "Your file is a python file!" in this example
# if it doesnt end with .py then it will output False
Comment

how to check if string ends with specific characters in python

Text = "python is easy"
print(Text.endswith("easy"))
Comment

PREVIOUS NEXT
Code Example
Python :: to text pandas 
Python :: python left string 
Python :: getting a column that corresponds to the average of two columns in pandas 
Python :: time complexity of data structures in python 
Python :: remove last element in list python 
Python :: how to remove .0 from string column with empty strings in python 
Python :: Use the correct syntax to print the first item in the fruits tuple. 
Python :: Math Module radians() Function in python 
Python :: menu extension in mit app inventor 
Python :: self._ in python 
Python :: python calculator app 
Python :: simple click counter in python 
Python :: show only lower diagonal in sns pairplot 
Python :: mayeutica 
Python :: how to make a ip tracker in python 
Python :: space weather dashboard build your own custom dashboard to analyze and predict weather 
Python :: jupyter notebook morse code francais 
Python :: make a effective figure in python 
Python :: python regex words with apostrophe in middle 
Shell :: conda install tqdm 
Shell :: check supervisord status 
Shell :: git change username email 
Shell :: install git-lfs ubuntu 18.04 
Shell :: maven test class 
Shell :: mysqlclient install ubuntu 
Shell :: install java 17 ubuntu 
Shell :: uninstalling eclipse from ubuntu 
Shell :: install redis on ubuntu 
Shell :: uninstall pgadmin3 ubuntu 
Shell :: how to install pipenv on mac 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =