Bases: fs.Entry
Return the contents of the file as a bytes object (str in 2.x)
Returns: | a bytes/str object corresponding to the contents of the file |
---|
Copy this file to another file or directory. If other is a directory, this file is copied into it, otherwise this file is copied over it.
Parameters: |
|
---|---|
Returns: | File object representing other |
Create this file optionally with specific security_. If the file already exists it will not be overwritten.
Parameters: | security – a security_.Security object |
---|---|
Returns: | this object |
Compare only the contents of the two files, ignoring everything else. Note that filecmp.cmp fails early.
Parameters: | other – anything accepted by file() |
---|---|
Returns: | True if the files are equal in contents |
Is this file equal in size, dates and attributes to another. if compare_contents is True, use filecmp to compare the contents of the files. Note that filecmp.cmp fails early.
Parameters: | other – anything accepted by file() |
---|---|
Compare_contents: | |
True to compare contents, False otherwise | |
Returns: | True if the files are equal in size, modification date, attributes and contents |
Create this file as a hard link from other
Parameters: | other – anything accepted by file() |
---|---|
Returns: | this File object |
Create other as a hard link to this file.
Parameters: | other – anything accepted by file() |
---|---|
Returns: | File object corresponding to other |
EXPERIMENTAL: Use the codecs.open function to open this file as a Python file object. Positional and keyword arguments are passed straight through to the codecs function.
Parameters: |
|
---|
Return the contents of the file as a text object (unicode in 2.x)
Parameters: | encoding – valid encoding to pass to codecs.open |
---|---|
Returns: | a text/unicode object corresponding to the contents of the file |
Create this file optionally with specific security_. If the file already exists it will not be overwritten.
Parameters: | security – a security_.Security object |
---|---|
Returns: | this object |
Zip the file up into a zipfile. By default, the zipfile will have the name of the file with ”.zip” appended and will be a sibling of the file. Also by default a new zipfile will be created, overwriting any existing one, and standard compression will be used. The filename will be stored without any directory information.
A different zipfile can be specific as the zip_filename parameter, and this can be appended to (if it exists) by specifying “a” as the mode param.
Parameters: |
|
---|---|
Returns: | a File object corresponding to the zipfile created |