6 for root, dirs, files in os.walk('.'):
8 if name.endswith('.cc'):
11 with open(os.path.join(root, name)) as f:
12 for l in f.readlines():
14 if l == 'using std::cout;':
16 if l == '#include <iostream>':
18 if (not include) and using:
20 with open(os.path.join(root, name)) as f:
21 last_was_include = False
23 for l in f.readlines():
24 if last_was_include and l == '\n' and not done:
25 print>>g,'#include <iostream>'
26 last_was_include = False
28 elif l.startswith('#include'):
29 last_was_include = True
32 shutil.move('tmp', os.path.join(root, name))