Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LanHao0/218f207b579943ce31c99bfeb844976b to your computer and use it in GitHub Desktop.
Save LanHao0/218f207b579943ce31c99bfeb844976b to your computer and use it in GitHub Desktop.
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