In [5]:
import sys
sys.path.append('C:\Users\David\Documents\Dropbox\IPython_Synced\lingpy-2.0')
In [6]:
import lingpy
In [2]:
def w2p(path):
return path.replace("\\", "/")
import os
for root, dirs, files in os.walk("C:\Python_packages\lingpy-2"):
for file in files:
if file[-3:] == '.py':
contents = open(w2p(root) + '/' + file, 'r').read()
contents = "# -*- coding: utf-8 -*-\n" + contents
open(w2p(root) + '/' + file, 'w').write(contents)
In [ ]: