| | |
- object
-
- classmethod
- complex
- dict
- file
- file
- float
- int
- list
- long
- property
- staticmethod
- str
- super
- tuple
- type
- unicode
class classmethod(object) |
| |
classmethod(function) -> method
Convert a function to be 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:
def f(cls, arg1, arg2, ...): ...
f = classmethod(f)
It can be called either on the class (e.g. C.f()) or on an instance
(e.g. C().f()). The instance is ignored except for its class.
If a class method is called for a derived class, the derived class
object is passed as the implied first argument.
Class methods are different than C++ or Java static methods.
If you want those, see the staticmethod builtin. |
| |
Methods defined here:
- __get__(...)
- descr.__get__(obj[, type]) -> value
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Data and non-method functions defined here:
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from object:
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __hash__(...)
- x.__hash__() <==> hash(x)
- __reduce__(...)
- helper for pickle
- __repr__(...)
- x.__repr__() <==> repr(x)
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
- __str__(...)
- x.__str__() <==> str(x)
Data and non-method functions inherited from object:
- __class__ = <type 'type'>
- the object's class
|
class complex(object) |
| |
complex(real[, imag]) -> complex number
Create a complex number from a real part and an optional imaginary part.
This is equivalent to (real + imag*1j) where imag defaults to 0. |
| |
Methods defined here:
- __abs__(...)
- x.__abs__() <==> abs(x)
- __add__(...)
- x.__add__(y) <==> x+y
- __coerce__(...)
- x.__coerce__(y) <==> coerce(x, y)
- __div__(...)
- x.__div__(y) <==> x/y
- __divmod__(...)
- x.__divmod__(y) <==> xdivmod(x, y)y
- __eq__(...)
- x.__eq__(y) <==> x==y
- __float__(...)
- x.__float__() <==> float(x)
- __floordiv__(...)
- x.__floordiv__(y) <==> x//y
- __ge__(...)
- x.__ge__(y) <==> x>=y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __gt__(...)
- x.__gt__(y) <==> x>y
- __hash__(...)
- x.__hash__() <==> hash(x)
- __int__(...)
- x.__int__() <==> int(x)
- __le__(...)
- x.__le__(y) <==> x<=y
- __long__(...)
- x.__long__() <==> long(x)
- __lt__(...)
- x.__lt__(y) <==> x<y
- __mod__(...)
- x.__mod__(y) <==> x%y
- __mul__(...)
- x.__mul__(y) <==> x*y
- __ne__(...)
- x.__ne__(y) <==> x!=y
- __neg__(...)
- x.__neg__() <==> -x
- __nonzero__(...)
- x.__nonzero__() <==> x != 0
- __pos__(...)
- x.__pos__() <==> +x
- __pow__(...)
- x.__pow__(y[, z]) <==> pow(x, y[, z])
- __radd__(...)
- x.__radd__(y) <==> y+x
- __rdiv__(...)
- x.__rdiv__(y) <==> y/x
- __rdivmod__(...)
- x.__rdivmod__(y) <==> ydivmod(y, x)x
- __repr__(...)
- x.__repr__() <==> repr(x)
- __rfloordiv__(...)
- x.__rfloordiv__(y) <==> y//x
- __rmod__(...)
- x.__rmod__(y) <==> y%x
- __rmul__(...)
- x.__rmul__(y) <==> y*x
- __rpow__(...)
- y.__rpow__(x[, z]) <==> pow(x, y[, z])
- __rsub__(...)
- x.__rsub__(y) <==> y-x
- __rtruediv__(...)
- x.__rtruediv__(y) <==> y/x
- __str__(...)
- x.__str__() <==> str(x)
- __sub__(...)
- x.__sub__(y) <==> x-y
- __truediv__(...)
- x.__truediv__(y) <==> x/y
- conjugate(...)
Data and non-method functions defined here:
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
- imag = <member 'imag' of 'complex' objects>
- the imaginary part of a complex number
- real = <member 'real' of 'complex' objects>
- the real part of a complex number
Methods inherited from object:
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __reduce__(...)
- helper for pickle
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
Data and non-method functions inherited from object:
- __class__ = <type 'type'>
- the object's class
|
class dict(object) |
| |
dict() -> new empty dictionary.
dict(mapping) -> new dictionary initialized from a mapping object's
(key, value) pairs.
dict(seq) -> new dictionary initialized as if via:
d = {}
for k, v in seq:
d[k] = v |
| |
Methods defined here:
- __cmp__(...)
- x.__cmp__(y) <==> cmp(x,y)
- __contains__(...)
- x.__contains__(y) <==> y in x
- __delitem__(...)
- x.__delitem__(y) <==> del x[y]
- __eq__(...)
- x.__eq__(y) <==> x==y
- __ge__(...)
- x.__ge__(y) <==> x>=y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __gt__(...)
- x.__gt__(y) <==> x>y
- __hash__(...)
- x.__hash__() <==> hash(x)
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __iter__(...)
- x.__iter__() <==> iter(x)
- __le__(...)
- x.__le__(y) <==> x<=y
- __len__(...)
- x.__len__() <==> len(x)
- __lt__(...)
- x.__lt__(y) <==> x<y
- __ne__(...)
- x.__ne__(y) <==> x!=y
- __repr__(...)
- x.__repr__() <==> repr(x)
- __setitem__(...)
- x.__setitem__(i, y) <==> x[i]=y
- clear(...)
- D.clear() -> None. Remove all items from D.
- copy(...)
- D.copy() -> a shallow copy of D
- get(...)
- D.get(k[,d]) -> D[k] if D.has_key(k), else d. d defaults to None.
- has_key(...)
- D.has_key(k) -> 1 if D has a key k, else 0
- items(...)
- D.items() -> list of D's (key, value) pairs, as 2-tuples
- iteritems(...)
- D.iteritems() -> an iterator over the (key, value) items of D
- iterkeys(...)
- D.iterkeys() -> an iterator over the keys of D
- itervalues(...)
- D.itervalues() -> an iterator over the values of D
- keys(...)
- D.keys() -> list of D's keys
- popitem(...)
- D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty
- setdefault(...)
- D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if not D.has_key(k)
- update(...)
- D.update(E) -> None. Update D from E: for k in E.keys(): D[k] = E[k]
- values(...)
- D.values() -> list of D's values
Data and non-method functions defined here:
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from object:
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __reduce__(...)
- helper for pickle
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
- __str__(...)
- x.__str__() <==> str(x)
Data and non-method functions inherited from object:
- __class__ = <type 'type'>
- the object's class
|
class file(object) |
| |
file(name[, mode[, buffering]]) -> file object
Open a file. The mode can be 'r', 'w' or 'a' for reading (default),
writing or appending. The file will be created if it doesn't exist
when opened for writing or appending; it will be truncated when
opened for writing. Add a 'b' to the mode for binary files.
Add a '+' to the mode to allow simultaneous reading and writing.
If the buffering argument is given, 0 means unbuffered, 1 means line
buffered, and larger numbers specify the buffer size.
Note: open() is an alias for file(). |
| |
Methods defined here:
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __iter__(...)
- x.__iter__() <==> iter(x)
- __repr__(...)
- x.__repr__() <==> repr(x)
- close(...)
- close() -> None or (perhaps) an integer. Close the file.
Sets data attribute .closed to true. A closed file cannot be used for
further I/O operations. close() may be called more than once without
error. Some kinds of file objects (for example, opened by popen())
may return an exit status upon closing.
- fileno(...)
- fileno() -> integer "file descriptor".
This is needed for lower-level file interfaces, such os.read().
- flush(...)
- flush() -> None. Flush the internal I/O buffer.
- isatty(...)
- isatty() -> true or false. True if the file is connected to a tty device.
- read(...)
- read([size]) -> read at most size bytes, returned as a string.
If the size argument is negative or omitted, read until EOF is reached.
- readinto(...)
- readinto() -> Undocumented. Don't use this; it may go away.
- readline(...)
- readline([size]) -> next line from the file, as a string.
Retain newline. A non-negative size argument limits the maximum
number of bytes to return (an incomplete line may be returned then).
Return an empty string at EOF.
- readlines(...)
- readlines([size]) -> list of strings, each a line from the file.
Call readline() repeatedly and return a list of the lines so read.
The optional size argument, if given, is an approximate bound on the
total number of bytes in the lines returned.
- seek(...)
- seek(offset[, whence]) -> None. Move to new file position.
Argument offset is a byte count. Optional argument whence defaults to
0 (offset from start of file, offset should be >= 0); other values are 1
(move relative to current position, positive or negative), and 2 (move
relative to end of file, usually negative, although many platforms allow
seeking beyond the end of a file).
Note that not all file objects are seekable.
- tell(...)
- tell() -> current file position, an integer (may be a long integer).
- truncate(...)
- truncate([size]) -> None. Truncate the file to at most size bytes.
Size defaults to the current file position, as returned by tell().
- write(...)
- write(str) -> None. Write string str to file.
Note that due to buffering, flush() or close() may be needed before
the file on disk reflects the data written.
- writelines(...)
- writelines(sequence_of_strings) -> None. Write the strings to the file.
Note that newlines are not added. The sequence can be any iterable object
producing strings. This is equivalent to calling write() for each string.
- xreadlines(...)
- xreadlines() -> next line from the file, as a string.
Equivalent to xreadlines.xreadlines(file). This is like readline(), but
often quicker, due to reading ahead internally.
Data and non-method functions defined here:
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
- closed = <attribute 'closed' of 'file' objects>
- flag set if the file is closed
- mode = <member 'mode' of 'file' objects>
- file mode ('r', 'w', 'a', possibly with 'b' or '+' added)
- name = <member 'name' of 'file' objects>
- file name
- softspace = <member 'softspace' of 'file' objects>
- flag indicating that a space needs to be printed; used by print
Methods inherited from object:
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __hash__(...)
- x.__hash__() <==> hash(x)
- __reduce__(...)
- helper for pickle
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
- __str__(...)
- x.__str__() <==> str(x)
Data and non-method functions inherited from object:
- __class__ = <type 'type'>
- the object's class
|
class float(object) |
| |
float(x) -> floating point number
Convert a string or number to a floating point number, if possible. |
| |
Methods defined here:
- __abs__(...)
- x.__abs__() <==> abs(x)
- __add__(...)
- x.__add__(y) <==> x+y
- __cmp__(...)
- x.__cmp__(y) <==> cmp(x,y)
- __coerce__(...)
- x.__coerce__(y) <==> coerce(x, y)
- __div__(...)
- x.__div__(y) <==> x/y
- __divmod__(...)
- x.__divmod__(y) <==> xdivmod(x, y)y
- __float__(...)
- x.__float__() <==> float(x)
- __floordiv__(...)
- x.__floordiv__(y) <==> x//y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __hash__(...)
- x.__hash__() <==> hash(x)
- __int__(...)
- x.__int__() <==> int(x)
- __long__(...)
- x.__long__() <==> long(x)
- __mod__(...)
- x.__mod__(y) <==> x%y
- __mul__(...)
- x.__mul__(y) <==> x*y
- __neg__(...)
- x.__neg__() <==> -x
- __nonzero__(...)
- x.__nonzero__() <==> x != 0
- __pos__(...)
- x.__pos__() <==> +x
- __pow__(...)
- x.__pow__(y[, z]) <==> pow(x, y[, z])
- __radd__(...)
- x.__radd__(y) <==> y+x
- __rdiv__(...)
- x.__rdiv__(y) <==> y/x
- __rdivmod__(...)
- x.__rdivmod__(y) <==> ydivmod(y, x)x
- __repr__(...)
- x.__repr__() <==> repr(x)
- __rfloordiv__(...)
- x.__rfloordiv__(y) <==> y//x
- __rmod__(...)
- x.__rmod__(y) <==> y%x
- __rmul__(...)
- x.__rmul__(y) <==> y*x
- __rpow__(...)
- y.__rpow__(x[, z]) <==> pow(x, y[, z])
- __rsub__(...)
- x.__rsub__(y) <==> y-x
- __rtruediv__(...)
- x.__rtruediv__(y) <==> y/x
- __str__(...)
- x.__str__() <==> str(x)
- __sub__(...)
- x.__sub__(y) <==> x-y
- __truediv__(...)
- x.__truediv__(y) <==> x/y
Data and non-method functions defined here:
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from object:
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __reduce__(...)
- helper for pickle
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
Data and non-method functions inherited from object:
- __class__ = <type 'type'>
- the object's class
|
class int(object) |
| |
int(x[, base]) -> integer
Convert a string or number to an integer, if possible. A floating point
argument will be truncated towards zero (this does not include a string
representation of a floating point number!) When converting a string, use
the optional base. It is an error to supply a base when converting a
non-string. |
| |
Methods defined here:
- __abs__(...)
- x.__abs__() <==> abs(x)
- __add__(...)
- x.__add__(y) <==> x+y
- __and__(...)
- x.__and__(y) <==> x&y
- __cmp__(...)
- x.__cmp__(y) <==> cmp(x,y)
- __coerce__(...)
- x.__coerce__(y) <==> coerce(x, y)
- __div__(...)
- x.__div__(y) <==> x/y
- __divmod__(...)
- x.__divmod__(y) <==> xdivmod(x, y)y
- __float__(...)
- x.__float__() <==> float(x)
- __floordiv__(...)
- x.__floordiv__(y) <==> x//y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __hash__(...)
- x.__hash__() <==> hash(x)
- __hex__(...)
- x.__hex__() <==> hex(x)
- __int__(...)
- x.__int__() <==> int(x)
- __invert__(...)
- x.__invert__() <==> ~x
- __long__(...)
- x.__long__() <==> long(x)
- __lshift__(...)
- x.__lshift__(y) <==> x<<y
- __mod__(...)
- x.__mod__(y) <==> x%y
- __mul__(...)
- x.__mul__(y) <==> x*y
- __neg__(...)
- x.__neg__() <==> -x
- __nonzero__(...)
- x.__nonzero__() <==> x != 0
- __oct__(...)
- x.__oct__() <==> oct(x)
- __or__(...)
- x.__or__(y) <==> x|y
- __pos__(...)
- x.__pos__() <==> +x
- __pow__(...)
- x.__pow__(y[, z]) <==> pow(x, y[, z])
- __radd__(...)
- x.__radd__(y) <==> y+x
- __rand__(...)
- x.__rand__(y) <==> y&x
- __rdiv__(...)
- x.__rdiv__(y) <==> y/x
- __rdivmod__(...)
- x.__rdivmod__(y) <==> ydivmod(y, x)x
- __repr__(...)
- x.__repr__() <==> repr(x)
- __rfloordiv__(...)
- x.__rfloordiv__(y) <==> y//x
- __rlshift__(...)
- x.__rlshift__(y) <==> y<<x
- __rmod__(...)
- x.__rmod__(y) <==> y%x
- __rmul__(...)
- x.__rmul__(y) <==> y*x
- __ror__(...)
- x.__ror__(y) <==> y|x
- __rpow__(...)
- y.__rpow__(x[, z]) <==> pow(x, y[, z])
- __rrshift__(...)
- x.__rrshift__(y) <==> y>>x
- __rshift__(...)
- x.__rshift__(y) <==> x>>y
- __rsub__(...)
- x.__rsub__(y) <==> y-x
- __rtruediv__(...)
- x.__rtruediv__(y) <==> y/x
- __rxor__(...)
- x.__rxor__(y) <==> y^x
- __sub__(...)
- x.__sub__(y) <==> x-y
- __truediv__(...)
- x.__truediv__(y) <==> x/y
- __xor__(...)
- x.__xor__(y) <==> x^y
Data and non-method functions defined here:
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from object:
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __reduce__(...)
- helper for pickle
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
- __str__(...)
- x.__str__() <==> str(x)
Data and non-method functions inherited from object:
- __class__ = <type 'type'>
- the object's class
|
class list(object) |
| |
list() -> new list
list(sequence) -> new list initialized from sequence's items |
| |
Methods defined here:
- __add__(...)
- x.__add__(y) <==> x+y
- __contains__(...)
- x.__contains__(y) <==> y in x
- __delitem__(...)
- x.__delitem__(y) <==> del x[y]
- __delslice__(...)
- x.__delslice__(i, j) <==> del x[i:j]
- __eq__(...)
- x.__eq__(y) <==> x==y
- __ge__(...)
- x.__ge__(y) <==> x>=y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __getslice__(...)
- x.__getslice__(i, j) <==> x[i:j]
- __gt__(...)
- x.__gt__(y) <==> x>y
- __hash__(...)
- x.__hash__() <==> hash(x)
- __iadd__(...)
- x.__iadd__(y) <==> x+=y
- __imul__(...)
- x.__imul__(y) <==> x*=y
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __le__(...)
- x.__le__(y) <==> x<=y
- __len__(...)
- x.__len__() <==> len(x)
- __lt__(...)
- x.__lt__(y) <==> x<y
- __mul__(...)
- x.__mul__(n) <==> x*n
- __ne__(...)
- x.__ne__(y) <==> x!=y
- __repr__(...)
- x.__repr__() <==> repr(x)
- __rmul__(...)
- x.__rmul__(n) <==> n*x
- __setitem__(...)
- x.__setitem__(i, y) <==> x[i]=y
- __setslice__(...)
- x.__setslice__(i, j, y) <==> x[i:j]=y
- append(...)
- L.append(object) -- append object to end
- count(...)
- L.count(value) -> integer -- return number of occurrences of value
- extend(...)
- L.extend(list) -- extend list by appending list elements
- index(...)
- L.index(value) -> integer -- return index of first occurrence of value
- insert(...)
- L.insert(index, object) -- insert object before index
- pop(...)
- L.pop([index]) -> item -- remove and return item at index (default last)
- remove(...)
- L.remove(value) -- remove first occurrence of value
- reverse(...)
- L.reverse() -- reverse *IN PLACE*
- sort(...)
- L.sort([cmpfunc]) -- sort *IN PLACE*; if given, cmpfunc(x, y) -> -1, 0, 1
Data and non-method functions defined here:
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from object:
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __reduce__(...)
- helper for pickle
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
- __str__(...)
- x.__str__() <==> str(x)
Data and non-method functions inherited from object:
- __class__ = <type 'type'>
- the object's class
|
class long(object) |
| |
long(x[, base]) -> integer
Convert a string or number to a long integer, if possible. A floating
point argument will be truncated towards zero (this does not include a
string representation of a floating point number!) When converting a
string, use the optional base. It is an error to supply a base when
converting a non-string. |
| |
Methods defined here:
- __abs__(...)
- x.__abs__() <==> abs(x)
- __add__(...)
- x.__add__(y) <==> x+y
- __and__(...)
- x.__and__(y) <==> x&y
- __cmp__(...)
- x.__cmp__(y) <==> cmp(x,y)
- __coerce__(...)
- x.__coerce__(y) <==> coerce(x, y)
- __div__(...)
- x.__div__(y) <==> x/y
- __divmod__(...)
- x.__divmod__(y) <==> xdivmod(x, y)y
- __float__(...)
- x.__float__() <==> float(x)
- __floordiv__(...)
- x.__floordiv__(y) <==> x//y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __hash__(...)
- x.__hash__() <==> hash(x)
- __hex__(...)
- x.__hex__() <==> hex(x)
- __int__(...)
- x.__int__() <==> int(x)
- __invert__(...)
- x.__invert__() <==> ~x
- __long__(...)
- x.__long__() <==> long(x)
- __lshift__(...)
- x.__lshift__(y) <==> x<<y
- __mod__(...)
- x.__mod__(y) <==> x%y
- __mul__(...)
- x.__mul__(y) <==> x*y
- __neg__(...)
- x.__neg__() <==> -x
- __nonzero__(...)
- x.__nonzero__() <==> x != 0
- __oct__(...)
- x.__oct__() <==> oct(x)
- __or__(...)
- x.__or__(y) <==> x|y
- __pos__(...)
- x.__pos__() <==> +x
- __pow__(...)
- x.__pow__(y[, z]) <==> pow(x, y[, z])
- __radd__(...)
- x.__radd__(y) <==> y+x
- __rand__(...)
- x.__rand__(y) <==> y&x
- __rdiv__(...)
- x.__rdiv__(y) <==> y/x
- __rdivmod__(...)
- x.__rdivmod__(y) <==> ydivmod(y, x)x
- __repr__(...)
- x.__repr__() <==> repr(x)
- __rfloordiv__(...)
- x.__rfloordiv__(y) <==> y//x
- __rlshift__(...)
- x.__rlshift__(y) <==> y<<x
- __rmod__(...)
- x.__rmod__(y) <==> y%x
- __rmul__(...)
- x.__rmul__(y) <==> y*x
- __ror__(...)
- x.__ror__(y) <==> y|x
- __rpow__(...)
- y.__rpow__(x[, z]) <==> pow(x, y[, z])
- __rrshift__(...)
- x.__rrshift__(y) <==> y>>x
- __rshift__(...)
- x.__rshift__(y) <==> x>>y
- __rsub__(...)
- x.__rsub__(y) <==> y-x
- __rtruediv__(...)
- x.__rtruediv__(y) <==> y/x
- __rxor__(...)
- x.__rxor__(y) <==> y^x
- __str__(...)
- x.__str__() <==> str(x)
- __sub__(...)
- x.__sub__(y) <==> x-y
- __truediv__(...)
- x.__truediv__(y) <==> x/y
- __xor__(...)
- x.__xor__(y) <==> x^y
Data and non-method functions defined here:
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from object:
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __reduce__(...)
- helper for pickle
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
Data and non-method functions inherited from object:
- __class__ = <type 'type'>
- the object's class
|
open = class file(object) |
| |
file(name[, mode[, buffering]]) -> file object
Open a file. The mode can be 'r', 'w' or 'a' for reading (default),
writing or appending. The file will be created if it doesn't exist
when opened for writing or appending; it will be truncated when
opened for writing. Add a 'b' to the mode for binary files.
Add a '+' to the mode to allow simultaneous reading and writing.
If the buffering argument is given, 0 means unbuffered, 1 means line
buffered, and larger numbers specify the buffer size.
Note: open() is an alias for file(). |
| |
Methods defined here:
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __iter__(...)
- x.__iter__() <==> iter(x)
- __repr__(...)
- x.__repr__() <==> repr(x)
- close(...)
- close() -> None or (perhaps) an integer. Close the file.
Sets data attribute .closed to true. A closed file cannot be used for
further I/O operations. close() may be called more than once without
error. Some kinds of file objects (for example, opened by popen())
may return an exit status upon closing.
- fileno(...)
- fileno() -> integer "file descriptor".
This is needed for lower-level file interfaces, such os.read().
- flush(...)
- flush() -> None. Flush the internal I/O buffer.
- isatty(...)
- isatty() -> true or false. True if the file is connected to a tty device.
- read(...)
- read([size]) -> read at most size bytes, returned as a string.
If the size argument is negative or omitted, read until EOF is reached.
- readinto(...)
- readinto() -> Undocumented. Don't use this; it may go away.
- readline(...)
- readline([size]) -> next line from the file, as a string.
Retain newline. A non-negative size argument limits the maximum
number of bytes to return (an incomplete line may be returned then).
Return an empty string at EOF.
- readlines(...)
- readlines([size]) -> list of strings, each a line from the file.
Call readline() repeatedly and return a list of the lines so read.
The optional size argument, if given, is an approximate bound on the
total number of bytes in the lines returned.
- seek(...)
- seek(offset[, whence]) -> None. Move to new file position.
Argument offset is a byte count. Optional argument whence defaults to
0 (offset from start of file, offset should be >= 0); other values are 1
(move relative to current position, positive or negative), and 2 (move
relative to end of file, usually negative, although many platforms allow
seeking beyond the end of a file).
Note that not all file objects are seekable.
- tell(...)
- tell() -> current file position, an integer (may be a long integer).
- truncate(...)
- truncate([size]) -> None. Truncate the file to at most size bytes.
Size defaults to the current file position, as returned by tell().
- write(...)
- write(str) -> None. Write string str to file.
Note that due to buffering, flush() or close() may be needed before
the file on disk reflects the data written.
- writelines(...)
- writelines(sequence_of_strings) -> None. Write the strings to the file.
Note that newlines are not added. The sequence can be any iterable object
producing strings. This is equivalent to calling write() for each string.
- xreadlines(...)
- xreadlines() -> next line from the file, as a string.
Equivalent to xreadlines.xreadlines(file). This is like readline(), but
often quicker, due to reading ahead internally.
Data and non-method functions defined here:
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
- closed = <attribute 'closed' of 'file' objects>
- flag set if the file is closed
- mode = <member 'mode' of 'file' objects>
- file mode ('r', 'w', 'a', possibly with 'b' or '+' added)
- name = <member 'name' of 'file' objects>
- file name
- softspace = <member 'softspace' of 'file' objects>
- flag indicating that a space needs to be printed; used by print
Methods inherited from object:
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __hash__(...)
- x.__hash__() <==> hash(x)
- __reduce__(...)
- helper for pickle
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
- __str__(...)
- x.__str__() <==> str(x)
Data and non-method functions inherited from object:
- __class__ = <type 'type'>
- the object's class
|
class property(object) |
| |
property(fget=None, fset=None, fdel=None, doc=None) -> property attribute
fget is a function to be used for getting an attribute value, and likewise
fset is a function for setting, and fdel a function for del'ing, an
attribute. Typical use is to define a managed attribute x:
class C(object):
def getx(self): return self.__x
def setx(self, value): self.__x = value
def delx(self): del self.__x
x = property(getx, setx, delx, "I'm the 'x' property.") |
| |
Methods defined here:
- __get__(...)
- descr.__get__(obj[, type]) -> value
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __set__(...)
- descr.__set__(obj, value)
Data and non-method functions defined here:
- __doc__ = 'property(fget=None, fset=None, fdel=None, doc=N...ty(getx, setx, delx, "I\'m the \'x\' property.")'
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
- fdel = <member 'fdel' of 'property' objects>
- fget = <member 'fget' of 'property' objects>
- fset = <member 'fset' of 'property' objects>
Methods inherited from object:
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __hash__(...)
- x.__hash__() <==> hash(x)
- __reduce__(...)
- helper for pickle
- __repr__(...)
- x.__repr__() <==> repr(x)
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
- __str__(...)
- x.__str__() <==> str(x)
Data and non-method functions inherited from object:
- __class__ = <type 'type'>
- the object's class
|
class str(object) |
| |
str(object) -> string
Return a nice string representation of the object.
If the argument is a string, the return value is the same object. |
| |
Methods defined here:
- __add__(...)
- x.__add__(y) <==> x+y
- __contains__(...)
- x.__contains__(y) <==> y in x
- __eq__(...)
- x.__eq__(y) <==> x==y
- __ge__(...)
- x.__ge__(y) <==> x>=y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __getslice__(...)
- x.__getslice__(i, j) <==> x[i:j]
- __gt__(...)
- x.__gt__(y) <==> x>y
- __hash__(...)
- x.__hash__() <==> hash(x)
- __le__(...)
- x.__le__(y) <==> x<=y
- __len__(...)
- x.__len__() <==> len(x)
- __lt__(...)
- x.__lt__(y) <==> x<y
- __mul__(...)
- x.__mul__(n) <==> x*n
- __ne__(...)
- x.__ne__(y) <==> x!=y
- __repr__(...)
- x.__repr__() <==> repr(x)
- __rmul__(...)
- x.__rmul__(n) <==> n*x
- __str__(...)
- x.__str__() <==> str(x)
- capitalize(...)
- S.capitalize() -> string
Return a copy of the string S with only its first character
capitalized.
- center(...)
- S.center(width) -> string
Return S centered in a string of length width. Padding is done
using spaces.
- count(...)
- S.count(sub[, start[, end]]) -> int
Return the number of occurrences of substring sub in string
S[start:end]. Optional arguments start and end are
interpreted as in slice notation.
- decode(...)
- S.decode([encoding[,errors]]) -> object
Decodes S using the codec registered for encoding. encoding defaults
to the default encoding. errors may be given to set a different error
handling scheme. Default is 'strict' meaning that encoding errors raise
a ValueError. Other possible values are 'ignore' and 'replace'.
- encode(...)
- S.encode([encoding[,errors]]) -> object
Encodes S using the codec registered for encoding. encoding defaults
to the default encoding. errors may be given to set a different error
handling scheme. Default is 'strict' meaning that encoding errors raise
a ValueError. Other possible values are 'ignore' and 'replace'.
- endswith(...)
- S.endswith(suffix[, start[, end]]) -> int
Return 1 if S ends with the specified suffix, otherwise return 0. With
optional start, test S beginning at that position. With optional end, stop
comparing S at that position.
- expandtabs(...)
- S.expandtabs([tabsize]) -> string
Return a copy of S where all tab characters are expanded using spaces.
If tabsize is not given, a tab size of 8 characters is assumed.
- find(...)
- S.find(sub [,start [,end]]) -> int
Return the lowest index in S where substring sub is found,
such that sub is contained within s[start,end]. Optional
arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- index(...)
- S.index(sub [,start [,end]]) -> int
Like S.find() but raise ValueError when the substring is not found.
- isalnum(...)
- S.isalnum() -> int
Return 1 if all characters in S are alphanumeric
and there is at least one character in S, 0 otherwise.
- isalpha(...)
- S.isalpha() -> int
Return 1 if all characters in S are alphabetic
and there is at least one character in S, 0 otherwise.
- isdigit(...)
- S.isdigit() -> int
Return 1 if there are only digit characters in S,
0 otherwise.
- islower(...)
- S.islower() -> int
Return 1 if all cased characters in S are lowercase and there is
at least one cased character in S, 0 otherwise.
- isspace(...)
- S.isspace() -> int
Return 1 if there are only whitespace characters in S,
0 otherwise.
- istitle(...)
- S.istitle() -> int
Return 1 if S is a titlecased string, i.e. uppercase characters
may only follow uncased characters and lowercase characters only cased
ones. Return 0 otherwise.
- isupper(...)
- S.isupper() -> int
Return 1 if all cased characters in S are uppercase and there is
at least one cased character in S, 0 otherwise.
- join(...)
- S.join(sequence) -> string
Return a string which is the concatenation of the strings in the
sequence. The separator between elements is S.
- ljust(...)
- S.ljust(width) -> string
Return S left justified in a string of length width. Padding is
done using spaces.
- lower(...)
- S.lower() -> string
Return a copy of the string S converted to lowercase.
- lstrip(...)
- S.lstrip() -> string
Return a copy of the string S with leading whitespace removed.
- replace(...)
- S.replace (old, new[, maxsplit]) -> string
Return a copy of string S with all occurrences of substring
old replaced by new. If the optional argument maxsplit is
given, only the first maxsplit occurrences are replaced.
- rfind(...)
- S.rfind(sub [,start [,end]]) -> int
Return the highest index in S where substring sub is found,
such that sub is contained within s[start,end]. Optional
arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- rindex(...)
- S.rindex(sub [,start [,end]]) -> int
Like S.rfind() but raise ValueError when the substring is not found.
- rjust(...)
- S.rjust(width) -> string
Return S right justified in a string of length width. Padding is
done using spaces.
- rstrip(...)
- S.rstrip() -> string
Return a copy of the string S with trailing whitespace removed.
- split(...)
- S.split([sep [,maxsplit]]) -> list of strings
Return a list of the words in the string S, using sep as the
delimiter string. If maxsplit is given, at most maxsplit
splits are done. If sep is not specified, any whitespace string
is a separator.
- splitlines(...)
- S.splitlines([keepends]) -> list of strings
Return a list of the lines in S, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends
is given and true.
- startswith(...)
- S.startswith(prefix[, start[, end]]) -> int
Return 1 if S starts with the specified prefix, otherwise return 0. With
optional start, test S beginning at that position. With optional end, stop
comparing S at that position.
- strip(...)
- S.strip() -> string
Return a copy of the string S with leading and trailing
whitespace removed.
- swapcase(...)
- S.swapcase() -> string
Return a copy of the string S with uppercase characters
converted to lowercase and vice versa.
- title(...)
- S.title() -> string
Return a titlecased version of S, i.e. words start with uppercase
characters, all remaining cased characters have lowercase.
- translate(...)
- S.translate(table [,deletechars]) -> string
Return a copy of the string S, where all characters occurring
in the optional argument deletechars are removed, and the
remaining characters have been mapped through the given
translation table, which must be a string of length 256.
- upper(...)
- S.upper() -> string
Return a copy of the string S converted to uppercase.
Data and non-method functions defined here:
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from object:
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __reduce__(...)
- helper for pickle
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
Data and non-method functions inherited from object:
- __class__ = <type 'type'>
- the object's class
|
class super(object) |
| |
super(type) -> unbound super object
super(type, obj) -> bound super object; requires isinstance(obj, type)
super(type, type2) -> bound super object; requires issubclass(type2, type)
Typical use to call a cooperative superclass method:
class C(B):
def meth(self, arg):
super(C, self).meth(arg) |
| |
Methods defined here:
- __get__(...)
- descr.__get__(obj[, type]) -> value
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __repr__(...)
- x.__repr__() <==> repr(x)
Data and non-method functions defined here:
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
- __self__ = <member '__self__' of 'super' objects>
- the instance invoking super(); may be None
- __thisclass__ = <member '__thisclass__' of 'super' objects>
- the class invoking super()
Methods inherited from object:
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __hash__(...)
- x.__hash__() <==> hash(x)
- __reduce__(...)
- helper for pickle
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
- __str__(...)
- x.__str__() <==> str(x)
Data and non-method functions inherited from object:
- __class__ = <type 'type'>
- the object's class
|
class type(object) |
| |
type(object) -> the object's type
type(name, bases, dict) -> a new type |
| |
Methods defined here:
- __call__(...)
- x.__call__(...) <==> x(...)
- __cmp__(...)
- x.__cmp__(y) <==> cmp(x,y)
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __hash__(...)
- x.__hash__() <==> hash(x)
- __repr__(...)
- x.__repr__() <==> repr(x)
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
- __subclasses__(...)
- __subclasses__() -> list of immediate subclasses
- mro(...)
- mro() -> list
return a type's method resolution order
Data and non-method functions defined here:
- __base__ = <type 'object'>
- __bases__ = (<type 'object'>,)
- __basicsize__ = 436
- __dict__ = <dict-proxy object>
- __dictoffset__ = 132
- __doc__ = "type(object) -> the object's type\ntype(name, bases, dict) -> a new type"
- __flags__ = 21995
- __itemsize__ = 20
- __module__ = '__builtin__'
- __mro__ = (<type 'type'>, <type 'object'>)
- __name__ = 'type'
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
- __weakrefoffset__ = 184
Methods inherited from object:
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __reduce__(...)
- helper for pickle
- __str__(...)
- x.__str__() <==> str(x)
Data and non-method functions inherited from object:
- __class__ = <type 'type'>
- the object's class
|
|