Did I find the right examples for you? yes no

All Samples(0)  |  Call(0)  |  Derive(0)  |  Import(0)
str(object='') -> string

Return a nice string representation of the object.
If the argument is a string, the return value is the same object.

src/c/o/Copy-Queue-HEAD/cpq_mvq.py   Copy-Queue(Download)
def check_dir(dirname):
    if not os.path.isdir(dirname):
        print "Error: {d} is not a directory or doesn't exist.".format(d=cfg.QDIR)
def get_next_id():
    li = os.listdir(cfg.QDIR)
    li = [int(t) for t in li if len(t)==4 and t.isdigit()]
    if not li:
        return '0001'
        next_id = str(max(li)+1).zfill(4)
        if int(next_id) > 9999:
            print "Error: there are too many tasks in {qdir}.".format(qdir=cfg.QDIR)
    These batch files will be executed by the daemon.
    fname = "{qdir}/{task}".format(qdir=cfg.QDIR, task=task_id)
    with open(fname, "w") as f:
        print >>f, 'cd {dir}'.format(dir=shellquote(os.getcwd()))
def main():

src/c/o/Copy-Queue-HEAD/cpq_mvq_daemon.py   Copy-Queue(Download)
    If there is a task, execute it and then remove it. In this case return True.
    batches = [t for t in os.listdir(cfg.QDIR) if len(t)==4 and t.isdigit()]
    if len(batches) == 0:
        return None
    # else
    first = sorted(batches)[0]
    fpath = "{qdir}/{fname}".format(qdir=cfg.QDIR, fname=first)