M
M
msagent332021-09-13 07:49:56
Python
msagent33, 2021-09-13 07:49:56

How to check if a string ends with a search word?

There is a line that is the path to the folder where the files are added. I need to collect files that have different names but always the same ending. for example Abracadabra112_kanal.xls here's how to write a regular expression or how to get around the fact that the file names can be completely different, but the ending is always the same.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Bannikov, 2021-09-13
@msagent33

'Абракадабра112_kanal.xls'.endswith('.xls')
https://docs.python.org/3/library/stdtypes.html#st...

D
Developer, 2021-09-13
@samodum

This "ending" has its own name ;)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question