• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(87541)  |  Call(87541)  |  Derive(0)  |  Import(0)
open(name[, mode[, buffering]]) -> file object

Open a file using the file() type, returns a file object.  This is the
preferred way to open a file.  See file.__doc__ for further information.

src/s/h/shedskin-HEAD/examples/rsync.py   shedskin(Download)
 
    # On the system containing the file that needs to be patched
    unpatched = open("testdata/unpatched.file", "rb")
    hashes = blockchecksums(unpatched, blocksize)
 
    # On the remote system after having received `hashes`
    patchedfile = open("testdata/patched.file", "rb")
    # System with the unpatched file after receiving `delta`
    unpatched.seek(0)
    save_to = open("testdata/locally-patched.file", "wb")
    patchstream(unpatched, save_to, delta, blocksize)
 

src/v/d/vdj-HEAD/bin/sample_imgt_with_replacement.py   vdj(Download)
 
if len(args) == 2:
    inhandle = open(args[0],'r')
    outhandle = open(args[1],'w')
elif len(args) == 1:
    inhandle = open(args[0],'r')

src/v/d/vdj-HEAD/bin/sample_imgt_without_replacement.py   vdj(Download)
 
if len(args) == 2:
    inhandle = open(args[0],'r')
    outhandle = open(args[1],'w')
elif len(args) == 1:
    inhandle = open(args[0],'r')

src/c/u/CUV-HEAD/examples/rbm/analyse/calc_part_func.py   CUV(Download)
    fn = os.path.join(cfg.basename, "info-0-%s.pickle"%cfg.idx)
    if not cfg.overwrite and os.path.exists(fn):
        with open(fn, "r") as f:
            stats = cPickle.load(f)
            if "nats" in stats:
    #load pickle with rbm cfg
    fn = os.path.join(cfg.basename, "info-0.pickle")
    with open(fn,"r") as f:
        rbmcfg=cPickle.load(f)
    cfg.dataset   = rbmcfg['dataset']
    fn = os.path.join(cfg.basename, "info-0-%s.pickle"%cfg.idx)
    if os.path.exists(fn):
        with open(fn, "r") as f:
            stats = cPickle.load(f)
    else:
    stats['cpf_time'    ] = strftime("%Y-%m-%d %H:%M:%S")
 
    with open(fn,"wb") as f:
        cPickle.dump(stats,f)
 

src/l/a/Langtangen-HEAD/src/py/examples/xdr.py   Langtangen(Download)
# pack list; 2nd arg is the function used to pack each element
p.pack_array([1.0, 0.1, 0.001], p.pack_double)
f=open('tmp.dat','w'); f.write(p.get_buffer()); f.close()
 
f=open('tmp.dat','r'); 

src/l/a/Langtangen-HEAD/src/py/examples/reverseformat.py   Langtangen(Download)
# distinguish between binary or text file (some OS might require this):
if binary:
    file = open(filename, 'rb')
else:
    file = open(filename, 'r')

src/p/s/psycopg2da-2.0.9/examples/copy_from.py   psycopg2da(Download)
# copy_from with default arguments, from open file
 
io = open('copy_from.txt', 'wr')
data = ['Tom\tJenkins\t37\n',
        'Madonna\t\\N\t45\n',
        'Federico\tDi Gregorio\t\\N\n']
io.writelines(data)
io.close()
 
io = open('copy_from.txt', 'r')
# copy_from using custom separator, from open file
 
io = open('copy_from.txt', 'wr')
data = ['Tom:Jenkins:37\n',
        'Madonna:\N:45\n',
        'Federico:Di Gregorio:\N\n']
io.writelines(data)
io.close()
 
io = open('copy_from.txt', 'r')
# copy_from using custom null identifier, from open file
 
io = open('copy_from.txt', 'wr')
data = ['Tom\tJenkins\t37\n',
        'Madonna\tNULL\t45\n',

src/w/o/WOFpy-0.1.1-alpha/examples/csv/csv_dao.py   WOFpy(Download)
    def get_all_sites(self):
        sites = []
        with open(self.sites_file_path, 'rb') as f:
            reader = csv.reader(f)
            at_header = True
    def get_site_by_code(self, site_code):
        with open(self.sites_file_path, 'rb') as f:
            reader = csv.reader(f)
            at_header = True
            for row in reader:
    def get_sites_by_codes(self, site_codes_arr):
        sites = []
        with open(self.sites_file_path, 'rb') as f:
            reader = csv.reader(f)
            at_header = True
 
            # Read values            
            with open(self.values_file_path, 'rb') as f:
                reader = csv.reader(f)
                at_header = True

src/l/a/latimes-appengine-template-0.022/appengine_template/google_appengine/lib/webob/docs/wiki-example-code/example.py   latimes-appengine-template(Download)
    def full_content(self):
        f = open(self.filename, 'rb')
        try:
            return f.read()
        finally:
        new_content = """<html><head><title>%s</title></head><body>%s</body></html>""" % (
            title, content)
        f = open(self.filename, 'wb')
        f.write(new_content)
        f.close()

src/c/o/cogen-0.2.1/examples/cogen-chat/ChatApp/ez_setup.py   cogen(Download)
            # if the download is interrupted.
            data = _validate_md5(egg_name, src.read())
            dst = open(saveto,"wb"); dst.write(data)
        finally:
            if src: src.close()
    for name in filenames:
        base = os.path.basename(name)
        f = open(name,'rb')
        md5_data[base] = md5(f.read()).hexdigest()
        f.close()
    import inspect
    srcfile = inspect.getsourcefile(sys.modules[__name__])
    f = open(srcfile, 'rb'); src = f.read(); f.close()
 
    match = re.search("\nmd5_data = {\n([^}]+)}", src)
 
    src = src[:match.start(1)] + repl + src[match.end(1):]
    f = open(srcfile,'w')
    f.write(src)
    f.close()

Previous  4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12  Next