Skip to content

Latest commit

 

History

History
55 lines (38 loc) · 681 Bytes

README.md

File metadata and controls

55 lines (38 loc) · 681 Bytes

Python utilities

Growing collection of helper functions implementing those little snippets you always have to google for.

Examples

Remove a file

# Write
remove_if_exists('unneeded.file')

# Instead of

if isfile('unneeded.file'):
    os.remove('unneeded.file')

# or
try:
    os.remove('unneeded.file')
except FileNotFoundError:
    pass

Make dirs:

# Write
make_dirs('dir')

# Instead of
if not isdir(path):
    makedirs(path)

# or
try:
    os.makedirs(path)
except FileExistsError:
    pass

TODO:

Priority:

  • Make a package

Meh:

  • Update readme
  • Add docstrings
  • Add more stuff

Warning

API will change, a lot.