Python doc 3.4 Tuples and Sequences

https://docs.python.org/3.5/tutorial/datastructures.html A tuple consists of a number of values separated by commas, for instance: On output tuples are always enclosed in parentheses, so that nested tuples are interpreted correctly; they may be input with or without surrounding parentheses, although often parentheses are necessary anyway (if the tuple is part of a larger expression). It is […]

Python doc 3.4 List comprehensions

https://docs.python.org/3.5/tutorial/datastructures.html List comprehensions provide a concise way to create lists. Common applications are to make new lists where each element is the result of some operations applied to each member of another sequence or iterable, or to create a subsequence of those elements that satisfy a certain condition. A list comprehension consists of brackets containing […]

Python doc 3.4 Using Lists as Stacks and Queues 103

https://docs.python.org/3.5/tutorial/datastructures.html The list methods make it very easy to use a list as a stack, where the last element added is the first element retrieved (“last-in, first-out”). To add an item to the top of the stack, use append(). To retrieve an item from the top of the stack, use pop() without an explicit index. […]

Python virtualenv and virtualenvwrapper

Install Python Install pip Install virtualenv https://virtualenv.pypa.io/en/stable/ virtualenv is a tool to create isolated Python environments. The basic problem being addressed is one of dependencies and versions, and indirectly permissions virtualenvwrapper http://virtualenvwrapper.readthedocs.io/en/latest/ virtualenvwrapper is a set of extensions to Ian Bicking’s virtualenv tool. The extensions include wrappers for creating and deleting virtual environments and otherwise […]

Python docs 3.4 List 102

https://docs.python.org/3.5/tutorial/datastructures.html The list data type has some more methods. Here are all of the methods of list objects: list.append(x) Add an item to the end of the list. Equivalent to a[len(a):] = [x]. list.extend(L) Extend the list by appending all the items in the given list. Equivalent to a[len(a):] = L. list.insert(i, x) Insert an […]

Python docs 3.4 List 101

https://docs.python.org/3.4/tutorial/introduction.html#lists Using the Python Interpreter. Python knows a number of compound data types, used to group together other values. The most versatile is the list, which can be written as a list of comma-separated values (items) between square brackets. Lists might contain items of different types, but usually the items all have the same type. […]