os.path

os.path

def _sample():
    logger = logging.getLogger(__name__)
    logger.debug('__file__ name : {}'.format(__file__))
    logger.debug('basename : {basename}'.format(basename=os.path.basename(__file__)))
    logger.debug('dirname  : {dirname}'.format(dirname=os.path.dirname(__file__)))
    logger.debug('abspath  : {abspath}'.format(abspath=os.path.abspath(__file__)))
  • log
[2018/06/10 12:00:24][DEBUG](utils.py:35:_sample) __file__ name : G:\workplace\py\sandbox\batch_sample\utils.py
[2018/06/10 12:00:24][DEBUG](utils.py:36:_sample) basename : utils.py
[2018/06/10 12:00:24][DEBUG](utils.py:37:_sample) dirname  : G:\workplace\py\sandbox\batch_sample
[2018/06/10 12:00:24][DEBUG](utils.py:38:_sample) abspath  : G:\workplace\py\sandbox\batch_sample\utils.py