Open a bz2 file. The mode can be 'r' or 'w', for reading (default) or
writing. When opened for writing, the file will be created if it doesn't
exist, and truncated otherwise. If the buffering argument is given, 0
means unbuffered, and larger numbers specify the buffer size. If
compresslevel is given, must be a number between 1 and 9.
Add a 'U' to mode to open the file for input with universal newline
support. Any line ending in the input file will be seen as a '\n' in
Python. Also, a file so opened gains the attribute 'newlines'; the value
for this attribute is one of None (no newline read yet), '\r', '\n',
'\r\n' or a tuple containing all the newline types seen. Universal
newlines are available only when reading.
|
|
|
|
file object
|
__init__(name,
mode='r',
buffering=0,
compresslevel=9)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
|
|
|
|
a new object with type S, a subtype of T
|
|
|
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value |
|
|
None or (perhaps) an integer
|
|
the next value, or raise StopIteration
|
|
string
|
read(size=...)
Read at most size uncompressed bytes, returned as a string. |
|
|
string
|
readline(size=...)
Return the next line from the file, as a string, retaining newline. |
|
|
list
|
readlines(size=...)
Call readline() repeatedly and return a list of lines read. |
|
|
None
|
seek(offset,
whence=...)
Move to new file position. |
|
|
int
|
tell()
Return the current file position, an integer (may be a long integer). |
|
|
None
|
write(data)
Write the 'data' string to file. |
|
|
None
|
writelines(sequence_of_strings)
Write the sequence of strings to the file. |
|
|
self
|
|
Inherited from object :
__hash__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__str__
|