Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
allendowney
GitHub Repository: allendowney/thinkbayes2
Path: blob/master/scripts/loop.py
1901 views
1
import sys, os
2
from glob import glob
3
4
def pipe(cmd):
5
fp = os.popen(cmd)
6
res = fp.read()
7
stat = fp.close()
8
return res, stat
9
10
def main(script, files='*.py'):
11
for file in glob(files):
12
if file in ['loop.py']:
13
continue
14
15
#cmd = '2to3 -w -f print %s' % (file,)
16
cmd = "sed -i 's/Gaussian/Normal/g' %s" % (file,)
17
print cmd
18
19
res, stat = pipe(cmd)
20
print res, stat
21
22
23
if __name__ == '__main__':
24
main(*sys.argv)
25
26