Advertisement
gsavix

vcard_extract_name_cellular

Feb 12th, 2017
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. """
  3. padronização contatos sc89
  4. p120221readcontatov1.py
  5. gsavix at google mail dot com
  6.  
  7. """
  8. #%%
  9. axfe = open('Z:/d17down/contatos-std/contatos-whats/contatos-entra.txt', 'r')
  10. axreg = axfe.readlines()
  11. axfe.close()
  12. axregs = ''
  13. axfs = open('Z:/d17down/contatos-std/contatos-whats/contatos-saida.txt','w')
  14.  
  15. for axn in axreg:
  16.     axregw = axn
  17.     axregw = axregw.replace('\n','')
  18.     if  axregw[:11] == 'BEGIN:VCARD':
  19.         axregs = ''
  20.         axcard = list()
  21.     if  axregw[:3] == 'FN:':
  22.         axcard.append(axregw)
  23.     if  axregw[:14] == 'TEL;TYPE=CELL:':
  24.         axcard.append(axregw)
  25.     if  axregw[:9] == 'END:VCARD':
  26.         for axlin in axcard:
  27.             axregs = axregs + axlin + '|'
  28.         axfs.write(axregs + '\n')
  29.         print(axregs)
  30. axfs.close()
  31.  
  32. #%%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement