From e029f60f1a5254f12b32a62e9a00947dcfc16aa5 Mon Sep 17 00:00:00 2001 From: Nishanth Amuluru Date: Tue, 12 Oct 2010 11:44:33 +0530 Subject: Finished writing_python_scripts --- writing_python_scripts/quickref.tex | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'writing_python_scripts/quickref.tex') diff --git a/writing_python_scripts/quickref.tex b/writing_python_scripts/quickref.tex index a0212b3..2b24fc9 100644 --- a/writing_python_scripts/quickref.tex +++ b/writing_python_scripts/quickref.tex @@ -1,11 +1,9 @@ -Creating a tuple:\\ -{\ex \lstinline| t = (1, "hello", 2.5)|} +See where python searches for modules:\\ +{\ex \lstinline| sys.path|} -Accessing elements of tuples:\\ -{\ex \lstinline| t[index] Ex: t[2]|} +Include our own path in PYTHONPATH:\\ +{\ex \lstinline| sys.path.append(our_path)|} -Accessing slices of tuples:\\ -{\ex \lstinline| t[start:stop:step]|} +Run certian code only if executed and not if imported:\\ +{\ex \lstinline| if __name__=="__main__": #do something|} -Swapping values:\\ -{\ex \lstinline| a, b = b, a|} -- cgit