3 python \- an interpreted, interactive, object-oriented programming language
66 Python is an interpreted, interactive, object-oriented programming
67 language that combines remarkable power with very clear syntax.
68 For an introduction to programming in Python you are referred to the
70 The Python Library Reference documents built-in and standard types,
71 constants, functions and modules.
72 Finally, the Python Reference Manual describes the syntax and
73 semantics of the core language in (perhaps too) much detail.
74 (These documents may be located via the
75 .B "INTERNET RESOURCES"
76 below; they may be installed on your system as well.)
78 Python's basic power can be extended with your own modules written in
80 On most systems such modules may be dynamically loaded.
81 Python is also adaptable as an extension language for existing
83 See the internal documentation for hints.
85 Documentation for installed Python modules and packages can be
89 .SH COMMAND LINE OPTIONS
92 Specify the command to execute (see next section).
93 This terminates the option list (following options are passed as
94 arguments to the command).
97 Turn on parser debugging output (for wizards only, depending on
101 Ignore environment variables like PYTHONPATH and PYTHONHOME that modify
102 the behavior of the interpreter.
105 Prints the usage for the interpreter executable and exits.
108 When a script is passed as first argument or the \fB\-c\fP option is
109 used, enter interactive mode after executing the script or the
110 command. It does not read the $PYTHONSTARTUP file. This can be
111 useful to inspect global variables or a stack trace when a script
114 .BI "\-m " module-name
117 for the named module and runs the corresponding
122 Turn on basic optimizations. This changes the filename extension for
123 compiled (bytecode) files from
125 to \fI.pyo\fP. Given twice, causes docstrings to be discarded.
128 Division control; see PEP 238. The argument must be one of "old" (the
129 default, int/int and long/long return an int or long), "new" (new
130 division semantics, i.e. int/int and long/long returns a float),
131 "warn" (old division semantics with a warning for int/int and
132 long/long), or "warnall" (old division semantics with a warning for
133 all use of the division operator). For a use of "warnall", see the
134 Tools/scripts/fixdiv.py script.
137 Disable the import of the module
139 and the site-dependent manipulations of
144 Issue a warning when a source file mixes tabs and spaces for
145 indentation in a way that makes it depend on the worth of a tab
146 expressed in spaces. Issue an error when the option is given twice.
149 Force stdin, stdout and stderr to be totally unbuffered. On systems
150 where it matters, also put stdin, stdout and stderr in binary mode.
151 Note that there is internal buffering in xreadlines(), readlines() and
152 file-object iterators ("for line in sys.stdin") which is not
153 influenced by this option. To work around this, you will want to use
154 "sys.stdin.readline()" inside a "while 1:" loop.
157 Print a message each time a module is initialized, showing the place
158 (filename or built-in module) from which it is loaded. When given
159 twice, print a message for each file that is checked for when
160 searching for a module. Also provides information on module cleanup
164 Prints the Python version number of the executable and exits.
167 Warning control. Python sometimes prints warning message to
169 A typical warning message has the following form:
170 .IB file ":" line ": " category ": " message.
171 By default, each warning is printed once for each source line where it
172 occurs. This option controls how often warnings are printed.
175 options may be given; when a warning matches more than one
176 option, the action for the last matching option is performed.
179 options are ignored (a warning message is printed about invalid
180 options when the first warning is issued). Warnings can also be
181 controlled from within a Python program using the
187 is one of the following
189 strings (or a unique abbreviation):
191 to ignore all warnings;
193 to explicitly request the default behavior (printing each warning once
196 to print a warning each time it occurs (this may generate many
197 messages if a warning is triggered repeatedly for the same source
198 line, such as inside a loop);
200 to print each warning only only the first time it occurs in each
203 to print each warning only the first time it occurs in the program; or
205 to raise an exception instead of printing a warning message.
210 .IB action : message : category : module : line.
213 is as explained above but only applies to messages that match the
214 remaining fields. Empty fields match all values; trailing empty
215 fields may be omitted. The
217 field matches the start of the warning message printed; this match is
218 case-insensitive. The
220 field matches the warning category. This must be a class name; the
221 match test whether the actual warning category of the message is a
222 subclass of the specified warning category. The full class name must
225 field matches the (fully-qualified) module name; this match is
228 field matches the line number, where zero matches all line numbers and
229 is thus equivalent to an omitted line number.
232 Skip the first line of the source. This is intended for a DOS
233 specific hack only. Warning: the line numbers in error messages will
235 .SH INTERPRETER INTERFACE
236 The interpreter interface resembles that of the UNIX shell: when
237 called with standard input connected to a tty device, it prompts for
238 commands and executes them until an EOF is read; when called with a
239 file name argument or with a file as standard input, it reads and
246 it executes the Python statement(s) given as
250 may contain multiple statements separated by newlines.
251 Leading whitespace is significant in Python statements!
252 In non-interactive mode, the entire input is parsed before it is
255 If available, the script name and additional arguments thereafter are
256 passed to the script in the Python variable
258 which is a list of strings (you must first
260 to be able to access it).
261 If no script name is given,
263 is an empty string; if
269 Note that options interpreted by the Python interpreter itself
273 In interactive mode, the primary prompt is `>>>'; the second prompt
274 (which appears when a command is not complete) is `...'.
275 The prompts can be changed by assignment to
279 The interpreter quits when it reads an EOF at a prompt.
280 When an unhandled exception occurs, a stack trace is printed and
281 control returns to the primary prompt; in non-interactive mode, the
282 interpreter exits after printing the stack trace.
283 The interrupt signal raises the
284 .I Keyboard\%Interrupt
285 exception; other UNIX signals are not caught (except that SIGPIPE is
286 sometimes ignored, in favor of the
288 exception). Error messages are written to stderr.
289 .SH FILES AND DIRECTORIES
290 These are subject to difference depending on local installation
291 conventions; ${prefix} and ${exec_prefix} are installation-dependent
292 and should be interpreted as for GNU software; they may be the same.
293 The default for both is \fI/usr/local\fP.
294 .IP \fI${exec_prefix}/bin/python\fP
295 Recommended location of the interpreter.
297 .I ${prefix}/lib/python<version>
299 .I ${exec_prefix}/lib/python<version>
301 Recommended locations of the directories containing the standard
305 .I ${prefix}/include/python<version>
307 .I ${exec_prefix}/include/python<version>
309 Recommended locations of the directories containing the include files
310 needed for developing Python extensions and embedding the
313 .IP \fI~/.pythonrc.py\fP
314 User-specific initialization file loaded by the \fIuser\fP module;
315 not used by default or by most applications.
316 .SH ENVIRONMENT VARIABLES
318 Change the location of the standard Python libraries. By default, the
319 libraries are searched in ${prefix}/lib/python<version> and
320 ${exec_prefix}/lib/python<version>, where ${prefix} and ${exec_prefix}
321 are installation-dependent directories, both defaulting to
322 \fI/usr/local\fP. When $PYTHONHOME is set to a single directory, its value
323 replaces both ${prefix} and ${exec_prefix}. To specify different values
324 for these, set $PYTHONHOME to ${prefix}:${exec_prefix}.
326 Augments the default search path for module files.
327 The format is the same as the shell's $PATH: one or more directory
328 pathnames separated by colons.
329 Non-existent directories are silently ignored.
330 The default search path is installation dependent, but generally
331 begins with ${prefix}/lib/python<version> (see PYTHONHOME above).
332 The default search path is always appended to $PYTHONPATH.
333 If a script argument is given, the directory containing the script is
334 inserted in the path in front of $PYTHONPATH.
335 The search path can be manipulated from within a Python program as the
339 If this is the name of a readable file, the Python commands in that
340 file are executed before the first prompt is displayed in interactive
342 The file is executed in the same name space where interactive commands
343 are executed so that objects defined or imported in it can be used
344 without qualification in the interactive session.
345 You can also change the prompts
351 Set this to a non-empty string to cause the \fItime\fP module to
352 require dates specified as strings to include 4-digit years, otherwise
353 2-digit years are converted based on rules described in the \fItime\fP
354 module documentation.
356 If this is set to a non-empty string it is equivalent to specifying
357 the \fB\-O\fP option. If set to an integer, it is equivalent to
358 specifying \fB\-O\fP multiple times.
360 If this is set to a non-empty string it is equivalent to specifying
361 the \fB\-d\fP option. If set to an integer, it is equivalent to
362 specifying \fB\-d\fP multiple times.
364 If this is set to a non-empty string it is equivalent to specifying
365 the \fB\-i\fP option.
367 If this is set to a non-empty string it is equivalent to specifying
368 the \fB\-u\fP option.
370 If this is set to a non-empty string it is equivalent to specifying
371 the \fB\-v\fP option. If set to an integer, it is equivalent to
372 specifying \fB\-v\fP multiple times.
374 The Python Software Foundation: http://www.python.org/psf
375 .SH INTERNET RESOURCES
376 Main website: http://www.python.org/
378 Documentation: http://docs.python.org/
380 Community website: http://starship.python.net/
382 Developer resources: http://www.python.org/dev/
384 FTP: ftp://ftp.python.org/pub/python/
386 Module repository: http://www.vex.net/parnassus/
388 Newsgroups: comp.lang.python, comp.lang.python.announce
390 Python is distributed under an Open Source license. See the file
391 "LICENSE" in the Python source distribution for information on terms &
392 conditions for accessing and otherwise using Python and for a
393 DISCLAIMER OF ALL WARRANTIES.