17.01.2015 Views

py Documentation - Read the Docs

py Documentation - Read the Docs

py Documentation - Read the Docs

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>py</strong> <strong>Documentation</strong>, Release 1.4.27.dev1<br />

LocalPath.remove(rec=1, ignore_errors=False)<br />

remove a file or directory (or a directory tree if rec=1). if ignore_errors is True, errors while removing<br />

directories will be ignored.<br />

LocalPath.computehash(hashtype=’md5’, chunksize=524288)<br />

return hexdigest of hashvalue for this file.<br />

LocalPath.new(**kw)<br />

create a modified version of this path. <strong>the</strong> following keyword arguments modify various path parts:<br />

a:/some/path/to/a/file.ext<br />

xx<br />

xxxxxxxxxxxxxxxxx<br />

xxxxxxxx<br />

xxxx<br />

xxx<br />

drive<br />

dirname<br />

basename<br />

purebasename<br />

ext<br />

LocalPath.join(*args, **kwargs)<br />

return a new path by appending all ‘args’ as path components. if abs=1 is used restart from root if any of<br />

<strong>the</strong> args is an absolute path.<br />

LocalPath.open(mode=’r’, ensure=False, encoding=None)<br />

return an opened file with <strong>the</strong> given mode.<br />

If ensure is True, create parent directories if needed.<br />

LocalPath.listdir(fil=None, sort=None)<br />

list directory contents, possibly filter by <strong>the</strong> given fil func and possibly sorted.<br />

LocalPath.size()<br />

return size of <strong>the</strong> underlying file object<br />

LocalPath.mtime()<br />

return last modification time of <strong>the</strong> path.<br />

LocalPath.co<strong>py</strong>(target, mode=False)<br />

co<strong>py</strong> path to target.<br />

LocalPath.rename(target)<br />

rename this path to target.<br />

LocalPath.dump(obj, bin=1)<br />

pickle object into path location<br />

LocalPath.mkdir(*args)<br />

create & return <strong>the</strong> directory joined with args.<br />

LocalPath.write_binary(data, ensure=False)<br />

write binary data into path. If ensure is True create missing parent directories.<br />

LocalPath.write_text(data, encoding, ensure=False)<br />

write text data into path using <strong>the</strong> specified encoding. If ensure is True create missing parent directories.<br />

LocalPath.write(data, mode=’w’, ensure=False)<br />

write data into path. If ensure is True create missing parent directories.<br />

LocalPath.ensure(*args, **kwargs)<br />

ensure that an args-joined path exists (by default as a file). if you specify a keyword argument ‘dir=True’<br />

<strong>the</strong>n <strong>the</strong> path is forced to be a directory path.<br />

LocalPath.stat(raising=True)<br />

Return an os.stat() tuple.<br />

6 Chapter 2. <strong>py</strong>.path

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!