Assignment X value
Makes name X local by default creates or changes name X in the current local scope. If X is declared global, this creates or changes name X in the enclosing module's scope. If X is declared nonlocal in Python 3.0, this changes name X in an enclosing function's scope. Local variables are stored in the call stack at runtime for quick access. Reference X Looks for name X in at most four scope categories in the current local scope function then in the local scopes of all lexically enclosing...
Python Portable SQL Database API
Python's portable SQL database API provides script portability between different vendor-specific SQL database packages. For each vendor, install the vendor-specific extension module, but write your scripts according to the portable database API. Your database scripts will largely continue working unchanged after migrating to a different underlying vendor package. Note that most database extension modules are not part of the Python standard library they must be fetched and installed separately....
formatself formatspec
Called by the format built-in function and by extension, the str.format method of str strings to produce a formatted string representation of an object. See Strings on page 19 and Built-in Functions on page 102. New in Python 2.6 and 3.0. hash__ self Invoked on dictionary self and hash self , and other hashed collection operations, including those of the set object type. This method returns a unique and unchanging integer hash-key.
string formatting zip[iterable [ iterable
Returns a series of tuples, where each ith tuple contains the ith element from each of the argument iterables. For example, zip 'ab', 'cd' returns 'a', 'c' and 'b', 'd' . At least one iterable is required, or a TypeError is raised. The result series is truncated to the length of the shortest argument iterable. With a single iterable argument, it returns a series of one-tuples. May also be used to unzip zipped tuples X, Y zip zip T1, T2 . In Python 2.6, this returns a list. In Python 3.0, it...
systemcmd
Executes a command string cmd in a subshell process. Returns the exit status of the spawned process. Unlike popen, does not connect to cmd's standard streams via pipes. Hints add an amp at the end of cmd to run the command in the background on Unix e.g., os.system 'python main.py amp ' use a DOS start command to launch programs easily on Windows e.g., os.system 'start file.html' . startfile filepathname Starts a file with its associated application. Acts like double-clicking the file in Windows...
Info Upk
gt gt gt BA 0 116 mutability gt gt gt BA.append 115 list methods See also the discussion of byte and bytearray methods in String methods on page 26, and the type constructor calls in Built-in Functions on page 102. Python 2.6 has bytearray but not bytes in 2.6 b'ccc' is a synonym for 'ccc', and creates a normal str string . In Python 2.X Unicode strings are written as u'string' in Python 3.0 the normal string type and literal are used for Unicode . Arbitrary Unicode characters can be written...
The for Statement
The for loop is a sequence or other iterable iteration that assigns items in iterable to target and runs the first suite for each. The for statement runs the else suite if the loop exits without hitting a break statement. target can be anything that can appear on the left side of an assignment statement e.g., for x, y in tuplelist . Since Python 2.2, this works by first trying to obtain an iterator object I with iter iterable and then calling that object's I._next_ method repeatedly until...
exec codestring [in globaldict [ localdict
The exec statement compiles and runs code strings. codestring is any Python statement or multiple statements separated by newlines as a string it is run in a namespace containing the exec, or the global local namespace dictionaries if specified localdict defaults to globaldict . codestring can also be a compiled code object. Also see compile , eval , and the Python 2.X execfile in Built-in Functions on page 102. In Python 3.0, this statement becomes the exec function see Built-in Functions on...