Is there a Python idiom for creating dot folders in home directory?

python

Solution

You can get user folder with `os.path.expanduser`:

on Win

>>> import os, os.path
>>> os.path.expanduser('~')
'C:\\Documents and Settings\\alko'

on *nix

>>> os.path.expanduser('~')
'/home/alko'

And create dotted folder with `os.mkdir` (works on both):

>>> hd = os.path.expanduser('~')
>>> os.mkdir(os.path.join(hd, '.my-config'))

Problem

I was wondering if there's an idiom for creating dot folders and files for saving config files in all operating systems using Python.

Original source