Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.