“””
“””
import os
print “os.listdir(os.getcwd())”
print os.listdir(os.getcwd())
for fname in os.listdir(os.getcwd()):
print fname
text=open(fname).read()
print “text.count( hi mom )”
print text.count(‘hi mom’)
“””
“””
import os
print “os.listdir(os.getcwd())”
print os.listdir(os.getcwd())
for fname in os.listdir(os.getcwd()):
print fname
text=open(fname).read()
print “text.count( hi mom )”
print text.count(‘hi mom’)
Posted in Mac OS-X, Macintosh Computers, Personal Computers, Programming Languages, Python, Software development
Tagged baby step, for, function call, import, print, program, Python, trivial
A philosophic reason to sets pointers to NULL after free’ing them.
On reflection, I think I got this one right, and I kinda like it! I have experienced other people’s double-free errors, surprisingly, but the value of crashing-on-access-via-null is persuasive to me. Making double-free happen silently and without error is a small cost for positively crashing on a rogue access through a freed pointer.