pyufunc.generate_dir_with_date#

pyufunc.generate_dir_with_date(root_dir='', date='', *, date_fmt='%Y-%m-%d', exist_ok=True)#

Generate directory with date.

Parameters:
  • root_dir (str, optional) – specify root dir, if not specified, use current dir. Defaults to “”.

  • date (str | datetime.datetime, optional) – specify the date. if not specified, use current date. Defaults to “”.

  • date_fmt (str, optional) – date format. Defaults to “%Y-%m-%d”.

  • exist_ok (bool, optional) – whether is create direct is it’s exist. Defaults to True.

Raises:

ValueError – date should be str or datetime

Returns:

directory string created with date

Return type:

str

Example

>>> from pyufunc import generate_dir_with_date
>>> generate_dir_with_date()
"/home/user/2024-05/2024-05-16"