Thus you should probably do: try: fh=open(Onefile, "r") Filecontents =
fh.readlines() # these files are verysmall, # other code here Summary[Onefile] = deepcopy(Stats)# associate each fh.close() except IOError: print("\n
I wrote a small Python program to count some simple statistics on a Visual Basic program thatI am maintaining.The Python program counts total lines, whitespace lines, comment lines, Public & Private Subroutines, Public and Private Functions.
The Python program takes about 20-40 seconds to count all
A friend recently asked my this didn't modify his original string variable
s1="this is a string"
s1.replace("is a", "is a short")
"this is a short string"
print s1
"this is a string"
After showing him to change it to this
s1 = s1.replace("is a", "is a short")
print s1
"this is a short string"