Как проверить, заканчивается ли строка подстроткой 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
Funyn Kayvanhs Khiatan