In [1]:
import os
import codecs
In [ ]:
for f in os.listdir("."):
head, tail = os.path.splitext(f)
if head.endswith("tp"):
newname = head[:-2].replace("tp_", "_")+tail
with open(f, "rb") as fl:t = fl.read() #, "utf8"
t = t.replace("tp ", " ").replace("tp_", "_").replace("tp ("," (").replace("tp]", "]").replace("tp.",".").replace("tp\n","\n")
with open(newname, "wb") as fl:t = fl.write(t)
print( newname )
In [15]:
for f in os.listdir("."):
head, tail = os.path.splitext(f)
if "pYPK0" in head and ".ipynb" in tail:
if head == "pYPK0":
continue
print(head+tail)
with open(f, "rb") as fl: t = fl.read()
t = t.replace("tp ", " ").replace("tp_", "_").replace("tp ("," (").replace("tp]", "]").replace("tp.",".").replace("tp\n","\n")
with open(f, "wb") as fl:t = fl.write(t)
In [21]:
for f in os.listdir("."):
head, tail = os.path.splitext(f)
if head.startswith("pMEC11"):
print(f)
with open(f, "rb") as fl: t = fl.read()
t = t.replace("tp ", " ").replace("tp_", "_").replace("tp ("," (").replace("tp]", "]").replace("tp.",".").replace("tp\n","\n")
with open(f, "wb") as fl:t = fl.write(t)
In [ ]: