Python get filename suffix

Python day 25:

When i was younger, I only dealt with latex, docx, pdf files. Since i started blogging, i use a lot more files such as jpg, peg, mov4, ipynb, py, md, sas, r , HTML.
Sometimes, it is a bit difficult to organize the files.
Today we are going to make a small python program to fetch the suffix. 

Little Goal: Use python to fetch the filename suffix.



def suffix(filename, has_dot=False):
    if 0< pos <len(filename) -1:
        index= pos if has_dot else pos +1
        return filename [index:]
        return " "


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Social media & sharing icons powered by UltimatelySocial
%d bloggers like this: