Snippets

Hello world

if __name__ == "__main__":
    print("Hello, world!")

Files

Remove

import shutil
shutil.rmtree(path)

Log

file_handler = logging.FileHandler('log.txt')
file_handler.setFormatter(formatter)
file_handler.setLevel(logging.INFO)

logger.addHandler(file_handler)

Web

Get

requests.get(url).content.decode(charset)