Skip to content

Instantly share code, notes, and snippets.

@bhavul
Created June 18, 2017 12:41
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 bhavul/bc30c7c846e8871665516eb4a457264b to your computer and use it in GitHub Desktop.
Save bhavul/bc30c7c846e8871665516eb4a457264b to your computer and use it in GitHub Desktop.
import os
import sys
from sets import Set
def main():
phoneDict = Set()
for afile in os.listdir(os.getcwd()):
print afile
fileBreak = afile.split('.')
datePhoneBreak = fileBreak[0].split('p')
phoneNum = datePhoneBreak[1]
date = datePhoneBreak[0]
# format phone number
if phoneNum[0] == '+':
phoneNum = phoneNum[3:]
elif phoneNum[0] == '0':
phoneNum = phoneNum[1:]
# print so you can see it
print "Phone : ",phoneNum
print "Date : ",date[2:10]
print "Time : ",date[10:12],':',date[12:14],':',date[14:16]
phoneDict.add(phoneNum)
f = open("phonenumbers.txt","w")
for a in phoneDict:
f.write(a)
f.write(":")
f.write("\n")
f.close()
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment