DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Strip Extension

06.21.2011
| 4047 views |
  • submit to reddit
        Get only the filename part of a string without the need to use os.path.splitext

def get_filename(path):
	return path[:path.rfind('.')]