Skip to content

Instantly share code, notes, and snippets.

@aniljava
Last active August 29, 2015 14:00
Show Gist options
  • Save aniljava/11269842 to your computer and use it in GitHub Desktop.
Save aniljava/11269842 to your computer and use it in GitHub Desktop.
PYTHON MASTER LIST OF UTILS
# UUID
import uuid
get_uuid = lambda:uuid.uuid4()
# get_id, string_to_id
toid = lambda data: ''.join(['_', k.lower()][k in '0123456789-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'] for k in data)
# subfolder distribution
import os
get_path_x = lambda file_name: os.path.join('root_folder', file_name[:4], file_name)
get_path = lambda root: lambda file_name: os.path.join(root, file_name[:4], file_name)
example = get_path_x('filename.txt')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment