All Samples(8510) | Call(8510) | Derive(0) | Import(0)
close() -> None or (perhaps) an integer. Close the file. Sets data attribute .closed to True. A closed file cannot be used for further I/O operations. close() may be called more than once without error. Some kinds of file objects (for example, opened by popen()) may return an exit status upon closing.
src/s/h/shedskin-HEAD/examples/rdb.py shedskin(Download)
a=array.array('B')
a.fromstring(f.read())
PState=a.tolist()
f.close()
except IOError,EOFError:
del PState[:]
if len(PState)!=21:
try:
f=file("iPod_Control/iTunes/iTunesPState","wb")
array.array('B',PState).tofile(f)
f.close()
except IOError:
log("FAILED.")
return 0
if p:
Rules.append(p)
# Rules+=filter(None,map(ParseRuleLine,f.read().split("\n")))
f.close()
except IOError:
pass
entry=iTunesSD.read(558)
except (IOError,EOFError):
pass
if iTunesSD: iTunesSD.close()
if len(header)==51:
log("Using iTunesSD headers from existing database.")
log("Fixing iTunesSD header.")
iTunesSD.seek(0)
iTunesSD.write("\0%c%c"%(total_count>>8,total_count&0xFF))
iTunesSD.close()
except IOError:
log("ERROR: Some strange errors occured while writing iTunesSD.")
log(" You may have to re-initialize the iPod using iTunes.")
src/m/a/matplotlib-HEAD/py4science/examples/logistic/sethna_ori/03-period_doubling/ori/PeriodDoubling.py matplotlib(Download)
output.write("\n")
for x,y in [(0.0,0.0),(1.0,1.0)]:
output.write("%g %g\n"%(x,y))
output.close()
def XStar(g, args=(), xMax = 0.5):
"""
src/m/a/matplotlib-HEAD/py4science/examples/logistic/sethna_ori/03-period_doubling/PeriodDoubling.py matplotlib(Download)
output.write("\n")
for x,y in [(0.0,0.0),(1.0,1.0)]:
output.write("%g %g\n"%(x,y))
output.close()
def XStar(g, args=(), xMax = 0.5):
"""
src/m/a/matplotlib-HEAD/matplotlib/examples/tests/backend_driver.py matplotlib(Download)
else:
tmpfile.write('\nsavefig(r"%s", dpi=150)' % outfile)
tmpfile.close()
start_time = time.time()
program = [x % {'name': basename} for x in python]
ret = run(program + [tmpfile_name] + switches)
src/m/a/matplotlib-HEAD/examples/tests/backend_driver.py matplotlib(Download)
else:
tmpfile.write('\nsavefig(r"%s", dpi=150)' % outfile)
tmpfile.close()
start_time = time.time()
program = [x % {'name': basename} for x in python]
ret = run(program + [tmpfile_name] + switches)
src/n/o/noen-HEAD/server/Python/src/BinarySampleWrite.py noen(Download)
binFile.write(formatOutput3Data(20,7,4,[[255,255,42],[0,0,255]]))
binFile.write(formatProjectChange([3,2,2]).rstrip('\n'))
binFile.write(formatInputData(1,8,'nanoseconds test:2199023255552',2199023255552,nanoSeconds).rstrip('\n'))
binFile.close()
print 'binary data written!'
def writeTestBinary():
binFile.write(formatOutput2Data(3,3,5,[[123,456],[789,101],[234,56789],[9854,45789],[10000,9899999]]))
binFile.write(formatOutput3Data(3,3,5,[123,789,234,9876,1000]))
binFile.close()
print 'binary data written to rows!'
writeData()
src/p/y/pyformex-0.8.2/pyformex/examples/SuperShape.py pyformex(Download)
def play():
global savefile
if savefile:
filename = savefile.name
savefile.close()
else:
filename = os.path.join(getcfg('datadir'),'supershape.txt')
src/p/y/pywebmvc-HEAD/sample-app/src/code/backend/FileBackedDB.py pywebmvc(Download)
def save(self, entry):
if not entry.id:
entry.id = self.__getNextId()
fp = file(self.filename, "a")
fp.write(self.__marshall(entry))
fp.close()
else:
data = "".join(map(lambda e: self.__marshall(e), entryList))
fp = file(self.filename, "w")
fp.write(data)
fp.close()
def findById(self, id):
return filter(lambda x: x.id == id, self.__readAllAddresses())[0]
def __readAllAddresses(self):
try:
fp = file(self.filename, "r")
rawData = fp.read().strip()
fp.close()
src/m/a/Matplotlib--JJ-s-dev-HEAD/examples/tests/backend_driver.py Matplotlib--JJ-s-dev(Download)
else:
tmpfile.write('\nsavefig(r"%s", dpi=150)' % outfile)
tmpfile.close()
start_time = time.time()
program = [x % {'name': basename} for x in python]
ret = run(program + [tmpfile_name] + switches)
src/a/c/Acme-Pythonic-Functions-HEAD/examples/pyex.py Acme-Pythonic-Functions(Download)
fh = file("test12345.txt", "w")
fh.writelines(a)
fh.close()
fh = file("test12345.txt", "r")
c = fh.readlines()
fh.close()
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next