Advertisement
Guest User

Untitled

a guest
Nov 12th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. months_map = {'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04', 'May': '05', 'Jun': '06', 'Jul': '07', 'Aug': '08', 'Sep': '09', 'Oct': '10', 'Nov': '11', 'Dec': '12',}
  2. for line in open("C:/users/jacob/desktop/python/input.txt").readlines():
  3.     if "-" in line: print(line.replace('\n', ""))
  4.     if "#" in line:
  5.         if int(line[3:5]) >= 51: theYear = 1900 + int(line[3:5])
  6.         else: theYear = 2000 + int(line[3:5])
  7.         print((str(theYear) + "-" + line[:2] + "-" + line[6:10]).replace('\n', ""))
  8.     if "/" in line:
  9.         if int(line[6:]) >= 51: theYear = 1900 + int(line[6:])
  10.         else: theYear = 2000 + int(line[6:])
  11.         print(str(theYear) + "-" + line[:2] + "-" + line[3:5])
  12.     if "*" in line: print(line[6:10] + "-" + line[3:5] + "-" + line[:2])
  13.     if "," in line:
  14.         if int(line[7:12]) <= 50: theYear = 2000 + int(line[7:12])
  15.         elif 50 < theYear <100: theYear = 1900 + int(line[7:12])
  16.         print((str(theYear) + "-" + months_map[line[0:3]] + "-" + line[4:6]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement