doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
monthdays2calendar(year, month) Return a list of the weeks in the month month of the year as full weeks. Weeks are lists of seven tuples of day numbers and weekday numbers.
python.library.calendar#calendar.Calendar.monthdays2calendar
monthdayscalendar(year, month) Return a list of the weeks in the month month of the year as full weeks. Weeks are lists of seven day numbers.
python.library.calendar#calendar.Calendar.monthdayscalendar
yeardatescalendar(year, width=3) Return the data for the specified year ready for formatting. The return value is a list of month rows. Each month row contains up to width months (defaulting to 3). Each month contains between 4 and 6 weeks and each week contains 1–7 days. Days are datetime.date objects.
python.library.calendar#calendar.Calendar.yeardatescalendar
yeardays2calendar(year, width=3) Return the data for the specified year ready for formatting (similar to yeardatescalendar()). Entries in the week lists are tuples of day numbers and weekday numbers. Day numbers outside this month are zero.
python.library.calendar#calendar.Calendar.yeardays2calendar
yeardayscalendar(year, width=3) Return the data for the specified year ready for formatting (similar to yeardatescalendar()). Entries in the week lists are day numbers. Day numbers outside this month are zero.
python.library.calendar#calendar.Calendar.yeardayscalendar
calendar.day_abbr An array that represents the abbreviated days of the week in the current locale.
python.library.calendar#calendar.day_abbr
calendar.day_name An array that represents the days of the week in the current locale.
python.library.calendar#calendar.day_name
calendar.firstweekday() Returns the current setting for the weekday to start each week.
python.library.calendar#calendar.firstweekday
class calendar.HTMLCalendar(firstweekday=0) This class can be used to generate HTML calendars. HTMLCalendar instances have the following methods: formatmonth(theyear, themonth, withyear=True) Return a month’s calendar as an HTML table. If withyear is true the year will be included in the header, otherwise just th...
python.library.calendar#calendar.HTMLCalendar
cssclasses A list of CSS classes used for each weekday. The default class list is: cssclasses = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"] more styles can be added for each day: cssclasses = ["mon text-bold", "tue", "wed", "thu", "fri", "sat", "sun red"] Note that the length of this list must be seven items.
python.library.calendar#calendar.HTMLCalendar.cssclasses
cssclasses_weekday_head A list of CSS classes used for weekday names in the header row. The default is the same as cssclasses. New in version 3.7.
python.library.calendar#calendar.HTMLCalendar.cssclasses_weekday_head
cssclass_month The CSS class for the whole month’s table (used by formatmonth()). The default value is "month". New in version 3.7.
python.library.calendar#calendar.HTMLCalendar.cssclass_month
cssclass_month_head The month’s head CSS class (used by formatmonthname()). The default value is "month". New in version 3.7.
python.library.calendar#calendar.HTMLCalendar.cssclass_month_head
cssclass_noday The CSS class for a weekday occurring in the previous or coming month. New in version 3.7.
python.library.calendar#calendar.HTMLCalendar.cssclass_noday
cssclass_year The CSS class for the whole year’s table of tables (used by formatyear()). The default value is "year". New in version 3.7.
python.library.calendar#calendar.HTMLCalendar.cssclass_year
cssclass_year_head The CSS class for the table head for the whole year (used by formatyear()). The default value is "year". New in version 3.7.
python.library.calendar#calendar.HTMLCalendar.cssclass_year_head
formatmonth(theyear, themonth, withyear=True) Return a month’s calendar as an HTML table. If withyear is true the year will be included in the header, otherwise just the month name will be used.
python.library.calendar#calendar.HTMLCalendar.formatmonth
formatyear(theyear, width=3) Return a year’s calendar as an HTML table. width (defaulting to 3) specifies the number of months per row.
python.library.calendar#calendar.HTMLCalendar.formatyear
formatyearpage(theyear, width=3, css='calendar.css', encoding=None) Return a year’s calendar as a complete HTML page. width (defaulting to 3) specifies the number of months per row. css is the name for the cascading style sheet to be used. None can be passed if no style sheet should be used. encoding specifies the en...
python.library.calendar#calendar.HTMLCalendar.formatyearpage
calendar.isleap(year) Returns True if year is a leap year, otherwise False.
python.library.calendar#calendar.isleap
calendar.leapdays(y1, y2) Returns the number of leap years in the range from y1 to y2 (exclusive), where y1 and y2 are years. This function works for ranges spanning a century change.
python.library.calendar#calendar.leapdays
class calendar.LocaleHTMLCalendar(firstweekday=0, locale=None) This subclass of HTMLCalendar can be passed a locale name in the constructor and will return month and weekday names in the specified locale. If this locale includes an encoding all strings containing month and weekday names will be returned as unicode.
python.library.calendar#calendar.LocaleHTMLCalendar
class calendar.LocaleTextCalendar(firstweekday=0, locale=None) This subclass of TextCalendar can be passed a locale name in the constructor and will return month and weekday names in the specified locale. If this locale includes an encoding all strings containing month and weekday names will be returned as unicode.
python.library.calendar#calendar.LocaleTextCalendar
calendar.month(theyear, themonth, w=0, l=0) Returns a month’s calendar in a multi-line string using the formatmonth() of the TextCalendar class.
python.library.calendar#calendar.month
calendar.monthcalendar(year, month) Returns a matrix representing a month’s calendar. Each row represents a week; days outside of the month are represented by zeros. Each week begins with Monday unless set by setfirstweekday().
python.library.calendar#calendar.monthcalendar
calendar.monthrange(year, month) Returns weekday of first day of the month and number of days in month, for the specified year and month.
python.library.calendar#calendar.monthrange
calendar.month_abbr An array that represents the abbreviated months of the year in the current locale. This follows normal convention of January being month number 1, so it has a length of 13 and month_abbr[0] is the empty string.
python.library.calendar#calendar.month_abbr
calendar.month_name An array that represents the months of the year in the current locale. This follows normal convention of January being month number 1, so it has a length of 13 and month_name[0] is the empty string.
python.library.calendar#calendar.month_name
calendar.prcal(year, w=0, l=0, c=6, m=3) Prints the calendar for an entire year as returned by calendar().
python.library.calendar#calendar.prcal
calendar.prmonth(theyear, themonth, w=0, l=0) Prints a month’s calendar as returned by month().
python.library.calendar#calendar.prmonth
calendar.setfirstweekday(weekday) Sets the weekday (0 is Monday, 6 is Sunday) to start each week. The values MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, and SUNDAY are provided for convenience. For example, to set the first weekday to Sunday: import calendar calendar.setfirstweekday(calendar.SUNDAY)
python.library.calendar#calendar.setfirstweekday
class calendar.TextCalendar(firstweekday=0) This class can be used to generate plain text calendars. TextCalendar instances have the following methods: formatmonth(theyear, themonth, w=0, l=0) Return a month’s calendar in a multi-line string. If w is provided, it specifies the width of the date columns, which are...
python.library.calendar#calendar.TextCalendar
formatmonth(theyear, themonth, w=0, l=0) Return a month’s calendar in a multi-line string. If w is provided, it specifies the width of the date columns, which are centered. If l is given, it specifies the number of lines that each week will use. Depends on the first weekday as specified in the constructor or set by t...
python.library.calendar#calendar.TextCalendar.formatmonth
formatyear(theyear, w=2, l=1, c=6, m=3) Return a m-column calendar for an entire year as a multi-line string. Optional parameters w, l, and c are for date column width, lines per week, and number of spaces between month columns, respectively. Depends on the first weekday as specified in the constructor or set by the ...
python.library.calendar#calendar.TextCalendar.formatyear
prmonth(theyear, themonth, w=0, l=0) Print a month’s calendar as returned by formatmonth().
python.library.calendar#calendar.TextCalendar.prmonth
pryear(theyear, w=2, l=1, c=6, m=3) Print the calendar for an entire year as returned by formatyear().
python.library.calendar#calendar.TextCalendar.pryear
calendar.timegm(tuple) An unrelated but handy function that takes a time tuple such as returned by the gmtime() function in the time module, and returns the corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX encoding. In fact, time.gmtime() and timegm() are each others’ inverse.
python.library.calendar#calendar.timegm
calendar.weekday(year, month, day) Returns the day of the week (0 is Monday) for year (1970–…), month (1–12), day (1–31).
python.library.calendar#calendar.weekday
calendar.weekheader(n) Return a header containing abbreviated weekday names. n specifies the width in characters for one weekday.
python.library.calendar#calendar.weekheader
callable(object) Return True if the object argument appears callable, False if not. If this returns True, it is still possible that a call fails, but if it is False, calling object will never succeed. Note that classes are callable (calling a class returns a new instance); instances are callable if their class has a ...
python.library.functions#callable
cgi — Common Gateway Interface support Source code: Lib/cgi.py Support module for Common Gateway Interface (CGI) scripts. This module defines a number of utilities for use by CGI scripts written in Python. Introduction A CGI script is invoked by an HTTP server, usually to process user input submitted through an HTML <F...
python.library.cgi
FieldStorage.getfirst(name, default=None) This method always returns only one value associated with form field name. The method returns only the first value in case that more values were posted under such name. Please note that the order in which the values are received may vary from browser to browser and should not...
python.library.cgi#cgi.FieldStorage.getfirst
FieldStorage.getlist(name) This method always returns a list of values associated with form field name. The method returns an empty list if no such form field or value exists for name. It returns a list consisting of one item if only one such value exists.
python.library.cgi#cgi.FieldStorage.getlist
cgi.parse(fp=None, environ=os.environ, keep_blank_values=False, strict_parsing=False, separator="&") Parse a query in the environment or from a file (the file defaults to sys.stdin). The keep_blank_values, strict_parsing and separator parameters are passed to urllib.parse.parse_qs() unchanged.
python.library.cgi#cgi.parse
cgi.parse_header(string) Parse a MIME header (such as Content-Type) into a main value and a dictionary of parameters.
python.library.cgi#cgi.parse_header
cgi.parse_multipart(fp, pdict, encoding="utf-8", errors="replace", separator="&") Parse input of type multipart/form-data (for file uploads). Arguments are fp for the input file, pdict for a dictionary containing other parameters in the Content-Type header, and encoding, the request encoding. Returns a dictionary jus...
python.library.cgi#cgi.parse_multipart
cgi.print_directory() Format the current directory in HTML.
python.library.cgi#cgi.print_directory
cgi.print_environ() Format the shell environment in HTML.
python.library.cgi#cgi.print_environ
cgi.print_environ_usage() Print a list of useful (used by CGI) environment variables in HTML.
python.library.cgi#cgi.print_environ_usage
cgi.print_form(form) Format a form in HTML.
python.library.cgi#cgi.print_form
cgi.test() Robust test CGI script, usable as main program. Writes minimal HTTP headers and formats all information provided to the script in HTML form.
python.library.cgi#cgi.test
cgitb — Traceback manager for CGI scripts Source code: Lib/cgitb.py The cgitb module provides a special exception handler for Python scripts. (Its name is a bit misleading. It was originally designed to display extensive traceback information in HTML for CGI scripts. It was later generalized to also display this inform...
python.library.cgitb
cgitb.enable(display=1, logdir=None, context=5, format="html") This function causes the cgitb module to take over the interpreter’s default handling for exceptions by setting the value of sys.excepthook. The optional argument display defaults to 1 and can be set to 0 to suppress sending the traceback to the browser. ...
python.library.cgitb#cgitb.enable
cgitb.handler(info=None) This function handles an exception using the default settings (that is, show a report in the browser, but don’t log to a file). This can be used when you’ve caught an exception and want to report it using cgitb. The optional info argument should be a 3-tuple containing an exception type, exce...
python.library.cgitb#cgitb.handler
cgitb.html(info, context=5) This function handles the exception described by info (a 3-tuple containing the result of sys.exc_info()), formatting its traceback as HTML and returning the result as a string. The optional argument context is the number of lines of context to display around the current line of source cod...
python.library.cgitb#cgitb.html
cgitb.text(info, context=5) This function handles the exception described by info (a 3-tuple containing the result of sys.exc_info()), formatting its traceback as text and returning the result as a string. The optional argument context is the number of lines of context to display around the current line of source cod...
python.library.cgitb#cgitb.text
exception ChildProcessError Raised when an operation on a child process failed. Corresponds to errno ECHILD.
python.library.exceptions#ChildProcessError
chr(i) Return the string representing a character whose Unicode code point is the integer i. For example, chr(97) returns the string 'a', while chr(8364) returns the string '€'. This is the inverse of ord(). The valid range for the argument is from 0 through 1,114,111 (0x10FFFF in base 16). ValueError will be raised ...
python.library.functions#chr
chunk — Read IFF chunked data Source code: Lib/chunk.py This module provides an interface for reading files that use EA IFF 85 chunks. 1 This format is used in at least the Audio Interchange File Format (AIFF/AIFF-C) and the Real Media File Format (RMFF). The WAVE audio file format is closely related and can also be re...
python.library.chunk
class chunk.Chunk(file, align=True, bigendian=True, inclheader=False) Class which represents a chunk. The file argument is expected to be a file-like object. An instance of this class is specifically allowed. The only method that is needed is read(). If the methods seek() and tell() are present and don’t raise an exc...
python.library.chunk#chunk.Chunk
close() Close and skip to the end of the chunk. This does not close the underlying file.
python.library.chunk#chunk.Chunk.close
getname() Returns the name (ID) of the chunk. This is the first 4 bytes of the chunk.
python.library.chunk#chunk.Chunk.getname
getsize() Returns the size of the chunk.
python.library.chunk#chunk.Chunk.getsize
isatty() Returns False.
python.library.chunk#chunk.Chunk.isatty
read(size=-1) Read at most size bytes from the chunk (less if the read hits the end of the chunk before obtaining size bytes). If the size argument is negative or omitted, read all data until the end of the chunk. An empty bytes object is returned when the end of the chunk is encountered immediately.
python.library.chunk#chunk.Chunk.read
seek(pos, whence=0) Set the chunk’s current position. The whence argument is optional and defaults to 0 (absolute file positioning); other values are 1 (seek relative to the current position) and 2 (seek relative to the file’s end). There is no return value. If the underlying file does not allow seek, only forward se...
python.library.chunk#chunk.Chunk.seek
skip() Skip to the end of the chunk. All further calls to read() for the chunk will return b''. If you are not interested in the contents of the chunk, this method should be called so that the file points to the start of the next chunk.
python.library.chunk#chunk.Chunk.skip
tell() Return the current position into the chunk.
python.library.chunk#chunk.Chunk.tell
class.mro() This method can be overridden by a metaclass to customize the method resolution order for its instances. It is called at class instantiation, and its result is stored in __mro__.
python.library.stdtypes#class.mro
class.__bases__ The tuple of base classes of a class object.
python.library.stdtypes#class.__bases__
class.__mro__ This attribute is a tuple of classes that are considered when looking for base classes during method resolution.
python.library.stdtypes#class.__mro__
class.__subclasses__() Each class keeps a list of weak references to its immediate subclasses. This method returns a list of all those references still alive. The list is in definition order. Example: >>> int.__subclasses__() [<class 'bool'>]
python.library.stdtypes#class.__subclasses__
@classmethod Transform a method into a class method. A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom: class C: @classmethod def f(cls, arg1, arg2, ...): ... The @classmethod form is a function decorato...
python.library.functions#classmethod
cmath — Mathematical functions for complex numbers This module provides access to mathematical functions for complex numbers. The functions in this module accept integers, floating-point numbers or complex numbers as arguments. They will also accept any Python object that has either a __complex__() or a __float__() met...
python.library.cmath
cmath.acos(x) Return the arc cosine of x. There are two branch cuts: One extends right from 1 along the real axis to ∞, continuous from below. The other extends left from -1 along the real axis to -∞, continuous from above.
python.library.cmath#cmath.acos
cmath.acosh(x) Return the inverse hyperbolic cosine of x. There is one branch cut, extending left from 1 along the real axis to -∞, continuous from above.
python.library.cmath#cmath.acosh
cmath.asin(x) Return the arc sine of x. This has the same branch cuts as acos().
python.library.cmath#cmath.asin
cmath.asinh(x) Return the inverse hyperbolic sine of x. There are two branch cuts: One extends from 1j along the imaginary axis to ∞j, continuous from the right. The other extends from -1j along the imaginary axis to -∞j, continuous from the left.
python.library.cmath#cmath.asinh
cmath.atan(x) Return the arc tangent of x. There are two branch cuts: One extends from 1j along the imaginary axis to ∞j, continuous from the right. The other extends from -1j along the imaginary axis to -∞j, continuous from the left.
python.library.cmath#cmath.atan
cmath.atanh(x) Return the inverse hyperbolic tangent of x. There are two branch cuts: One extends from 1 along the real axis to ∞, continuous from below. The other extends from -1 along the real axis to -∞, continuous from above.
python.library.cmath#cmath.atanh
cmath.cos(x) Return the cosine of x.
python.library.cmath#cmath.cos
cmath.cosh(x) Return the hyperbolic cosine of x.
python.library.cmath#cmath.cosh
cmath.e The mathematical constant e, as a float.
python.library.cmath#cmath.e
cmath.exp(x) Return e raised to the power x, where e is the base of natural logarithms.
python.library.cmath#cmath.exp
cmath.inf Floating-point positive infinity. Equivalent to float('inf'). New in version 3.6.
python.library.cmath#cmath.inf
cmath.infj Complex number with zero real part and positive infinity imaginary part. Equivalent to complex(0.0, float('inf')). New in version 3.6.
python.library.cmath#cmath.infj
cmath.isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0) Return True if the values a and b are close to each other and False otherwise. Whether or not two values are considered close is determined according to given absolute and relative tolerances. rel_tol is the relative tolerance – it is the maximum allowed difference b...
python.library.cmath#cmath.isclose
cmath.isfinite(x) Return True if both the real and imaginary parts of x are finite, and False otherwise. New in version 3.2.
python.library.cmath#cmath.isfinite
cmath.isinf(x) Return True if either the real or the imaginary part of x is an infinity, and False otherwise.
python.library.cmath#cmath.isinf
cmath.isnan(x) Return True if either the real or the imaginary part of x is a NaN, and False otherwise.
python.library.cmath#cmath.isnan
cmath.log(x[, base]) Returns the logarithm of x to the given base. If the base is not specified, returns the natural logarithm of x. There is one branch cut, from 0 along the negative real axis to -∞, continuous from above.
python.library.cmath#cmath.log
cmath.log10(x) Return the base-10 logarithm of x. This has the same branch cut as log().
python.library.cmath#cmath.log10
cmath.nan A floating-point “not a number” (NaN) value. Equivalent to float('nan'). New in version 3.6.
python.library.cmath#cmath.nan
cmath.nanj Complex number with zero real part and NaN imaginary part. Equivalent to complex(0.0, float('nan')). New in version 3.6.
python.library.cmath#cmath.nanj
cmath.phase(x) Return the phase of x (also known as the argument of x), as a float. phase(x) is equivalent to math.atan2(x.imag, x.real). The result lies in the range [-π, π], and the branch cut for this operation lies along the negative real axis, continuous from above. On systems with support for signed zeros (whic...
python.library.cmath#cmath.phase
cmath.pi The mathematical constant π, as a float.
python.library.cmath#cmath.pi
cmath.polar(x) Return the representation of x in polar coordinates. Returns a pair (r, phi) where r is the modulus of x and phi is the phase of x. polar(x) is equivalent to (abs(x), phase(x)).
python.library.cmath#cmath.polar
cmath.rect(r, phi) Return the complex number x with polar coordinates r and phi. Equivalent to r * (math.cos(phi) + math.sin(phi)*1j).
python.library.cmath#cmath.rect
cmath.sin(x) Return the sine of x.
python.library.cmath#cmath.sin
cmath.sinh(x) Return the hyperbolic sine of x.
python.library.cmath#cmath.sinh