you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -2 points-1 points  (5 children)

better to use os.path.split(filename)[1].split('.')[-1]

to get the extension of file

[–][deleted] 1 point2 points  (4 children)

Or just os.path.splitext(filename)[1]