All Samples(90843) | Call(90843) | 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/e/a/eagle-gtk-0.7/examples/vareditor.py eagle-gtk(Download)
# Line format is:
# [export] varname=["]contents["]
f = open( fname, "r" )
for ln, line in enumerate( f ):
try:
def save_table( table, fname ):
f = open( fname, "w" )
for n, ( export, var, contents ) in enumerate( table ):
if not ( var and contents ):
error( "Invalid line %d skipped" % n )
src/e/t/etk.docking-0.2/doc/examples/demo.py etk.docking(Download)
def _on_save_button_clicked(self, button):
file = 'demo.sav'
s = dockstore.serialize(self.docklayout)
with open(file, 'w') as f:
def _on_load_button_clicked(self, button):
file = 'demo.sav'
with open(file) as f:
s = f.read()
src/g/o/google_appengine-HEAD/lib/webob/docs/wiki-example-code/example.py google_appengine(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/s/i/SimpleExampleEgg-0.2/ez_setup/__init__.py SimpleExampleEgg(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()
src/p/y/pyseo-0.0.3/examples/positonchecker-cli/poschecker.py pyseo(Download)
# damn, when did python 2.5 would be stable everywhere?
# I realy need with istruction
f = open('domain.txt', 'r')
domain = f.readline().strip()
except:
# 1: open phases file
try:
f = open('phases.txt')
phases = []
line = f.readline()
# 4: output:
try:
f = open('posstats.txt', 'a')
f.write("\n" + time.strftime("%d.%m.%Y", time.localtime()) + "\n")
for r in ret:
src/p/s/psycopg2-2.4.6/examples/copy_from.py psycopg2(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/a/p/appscript-1.0.1/appscript_2x/sample/appscript/iTunes_playlist_to_HTML.py appscript(Download)
def write(path, txt):
f = open(path, 'w')
f.write(txt)
f.close()
src/t/i/tic-HEAD/src/tic/development/closure/source.py tic(Download)
"""
fileobj = open(path)
try:
return fileobj.read()
src/p/y/pyelftools-0.20/examples/examine_dwarf_info.py pyelftools(Download)
def process_file(filename):
print('Processing file:', filename)
with open(filename, 'rb') as f:
elffile = ELFFile(f)
src/e/t/etvsm-HEAD/trunk/beta2/examples/eTVSM_example.py etvsm(Download)
from etvsm.Themenkomplex import Themenkomplex
f = open('./Beispiel.txt', 'r')
myTM = TopicMap.importFile( f, mapName='Kuropka S.147')
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next