Created
June 18, 2017 12:41
-
-
Save bhavul/bc30c7c846e8871665516eb4a457264b to your computer and use it in GitHub Desktop.
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
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