Snippets
Hello world
if __name__ == "__main__":
print("Hello, world!")
Files
Links
os.symlink('target', 'tmp_path')
os.replace('tmp_path', 'path')
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)