Created
May 1, 2019 02:38
-
-
Save LanHao0/218f207b579943ce31c99bfeb844976b to your computer and use it in GitHub Desktop.
This file contains 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
bad_words = ['Pixel','Uptimebot/1.0;','DotBot/1.1;',' MJ12bot/v1.4.8','GrapeshotCrawler/2.0;','115.216.108.86','Baiduspider/2.0;','YisouSpider/5.0','"Sogou','"IAS crawler','FeedFetcher-Google','"CheckMarkNetwork/1.0','GoogleImageProxy)"',' /generate_204'] | |
with open('access.txt') as oldfile, open('newfile.txt', 'w') as newfile: | |
for line in oldfile: | |
if not any(bad_word in line for bad_word in bad_words): | |
newfile.write(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment