Skip to content

Instantly share code, notes, and snippets.

@anandology
Created June 3, 2011 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anandology/1006125 to your computer and use it in GitHub Desktop.
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.
"""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