Advertisement
Guest User

Untitled

a guest
Aug 17th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. httpsgoogledotcom, GooglePlace2, Direcciones, Montain View, Email, googplace@yourplace.com
  2.  
  3. > httpsgoogledotcom, GooglePlace, Website, "<a> href='httpgoogledotcom'></a>",,,,,,,,,,,,,,
  4. > "<a href='httpgoogledotcom'></a>",,,,,,,,,,,,,
  5. > ,,Direcciones, Montain View, Email, googplace@yourplace.com
  6. > httpsbingdotcom, BingPlace, Direcciones, MicroWorld, Email, bing@yourplace.com
  7.  
  8. > httpsgoogledotcom, GooglePlace, Website, "<a> href='httpgoogledotcom'></a>",,,,,,,,,,,,,,
  9. > "<a href='httpgoogledotcom'></a>",,,,,,,,,,,,,
  10. > httpsbingdotcom, BingPlace, Direcciones, MicroWorld, Email, bing@yourplace.com
  11.  
  12. > httpsgoogledotcom, GooglePlace, Website, "<a href='httpgoogledotcom'></a>",Direcciones, Montain View, Email, googplace@yourplace.com
  13. > httpsbingdotcom, BingPlace, Direcciones,MicroWorld, Email, bing@yourplace.com
  14. > httpsgoogledotcom, GooglePlace,Website, <a href='httpgoogledotcom'></a>"
  15.  
  16. import re
  17. with open('Reutput.csv') as reuf, open('Put.csv', 'w') as putuf:
  18. text = str(reuf.read())
  19. for lines in text:
  20. regex = re.compile('</a>".*?Direc',re.DOTALL)
  21. groups = re.search('</a>".*?Direc',lines,re.DOTALL)
  22. if not 'https' in groups:
  23. replace = re.sub(regex,'</a>",Direc',text)
  24. if 'https' in groups:
  25. replace = re.sub(regex,'</a>"nhttp',text)
  26. replace = str(replace)
  27. putuf.write(replace)
  28. reuf.close()
  29. putuf.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement