Skip to content
Advertisement

Python f string with folders

I’m trying to use regex to find a specific file name in a folder, however it seems like my regex is not working.

Inside my folder the names of the excel files are

JavaScript
JavaScript

Advertisement

Answer

You are not testing your regex against anything. pattern.fullmatch will return a method object. You probably wanted to write

JavaScript

That being said, I don’t see a reason to use a regex here. You can simply do

JavaScript

or even better (without checking all files in the folder):

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement