Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open("domains.txt", "r") as dirty_domains:
- lines = dirty_domains.readlines()
- clean_domains = []
- for domain in lines:
- domain = domain.replace("\n", "")
- without_sub = re.search(r'(?<=\.).*\..*', domain)
- if(without_sub != None):
- clean_domains.append(without_sub.group(0))
- else:
- clean_domains.append(domain)
- with open("clean_domains.txt", "w") as filehandle:
- for domain in clean_domains:
- filehandle.write('%s\n' % domain)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement