Created
June 8, 2014 16:59
-
-
Save Yepoleb/b11aef2efc5c7e97b513 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os.path | |
import re | |
oldfiles = "playerfiles/" | |
newfiles = "newfiles" | |
logre = re.compile("logout: (\d+)") | |
for filename in os.listdir(oldfiles): | |
oldpath = os.path.join(oldfiles, filename) | |
newpath = os.path.join(newfiles, filename) | |
f = open(oldpath, "r") | |
text = f.read() | |
f.close() | |
logouts = logre.search(text).group(1) | |
logoutms = int(logouts) * 1000 | |
logoutstr = "logout: {}".format(logoutms) | |
newtext = logre.sub(logoutstr, text) | |
f = open(newpath, "w") | |
f.write(newtext) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment