Created
June 3, 2011 10:01
-
-
Save anandology/1006125 to your computer and use it in GitHub Desktop.
Script to format the conversation text copied from skype window for better readability.
This file contains hidden or 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
"""Script to format the conversation text copied from skype window for better readability. | |
""" | |
import sys | |
import re | |
import web | |
re_timeline = re.compile("^([^/]* )?((?:\d\d/\d\d/\d\d )?\d\d?:\d\d [AP]M) *$") | |
def parse_text(text): | |
lines = text.strip().splitlines() | |
for line in lines: | |
line = line.strip() | |
m = re_timeline.match(line) | |
if m: | |
name, time = m.groups() | |
if name: | |
print name.strip() + ":" | |
print " " + time, | |
else: | |
print line | |
def main(): | |
text = sys.stdin.read() | |
parse_text(text) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment