From c7e94597c154d0ae712ac523ca0d38852fa781a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Tue, 7 Nov 2017 20:35:28 +0100 Subject: [PATCH] Initial commit --- README.md | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..1a65b44 --- /dev/null +++ b/README.md @@ -0,0 +1,104 @@ +Python and Libraries Cheatsheet +=============================== + +Sum +--- +``` +sum() +``` + +Profile +------- +``` +import pycallgraph +graph = pycallgraph.output.GraphvizOutput() +graph.output_file = +whith pycallgraph.PyCallGraph(output=graph): + +``` + +SQLite +------ +``` +import sqlite3 +db = sqlite3.connect() +``` + +### Read +``` +cursor = db.execute() +if cursor: + cursor.() +db.close() +``` + +### Write +``` +db.execute() +db.commit() +``` + +Curses +------ +``` +import curses +def main(): + curses.wrapper(draw) +def draw(screen): + screen.clear() + screen.addstr(0, 0, "Press ESC to quit.") + while screen.getch() != 27: + pass +``` + +Regex +----- +``` +import re +re.sub(, , ) +re.search(, ) +``` + +Threading +--------- +``` +import threading +``` + +### Thread +``` +thread = threading.Thread(target=, args=(, )) +thread.start() +thread.join() +``` + +### Lock +``` +lock = threading.Rlock() +lock.acquire() +lock.release() +``` + +Bottle +------ +``` +import bottle +``` + +### Run +``` +bottle.run(host='localhost', port=8080) +bottle.run(host='0.0.0.0', port=80, server='cherypy') +``` + +### Static request + +### Dynamic request + +### REST request + +Type +---- + + +