User Tools

Site Tools


python_notes

dummy

tasks

where is a module imported from

tags | module path

one way:

import importlib
importlib.util.find_spec("foo")

Alternative:

import imp
imp.find_module("foo")

Note:

  • The imp module is deprecated in favour of importlib. So use the first approach whenever possible.

get the function name

empty file

Task: If input file is empty, write an empty output file

import os
if os.stat(input_file).st_size == 0:
    logger.info('Input file is empty.')
    logger.info('Writing an empty output file.')
    with open(output_file, 'w') as fp:
        pass

config files

python mailing list

python reference

python tutorials

python release cycle

memory consumed by a function

dummy

python_notes.txt · Last modified: 2021/04/11 12:15 by raju