Skip to content
Advertisement

Python associate function

I want to add the file extensions found in the function to the line of code where I specified “HERE”. In other words, not only “.txt”, but also the extensions of the above function should be brought that part. In short, I want to associate the following code with the function.

Can you help me, with this?

JavaScript

Advertisement

Answer

Assuming that the only . in the string file_path is the one that starts the file extension, this rewrite of your function should do the job:

JavaScript

Then in the if statement you can call extension_finder with the path you want to check.

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