Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bs4 import BeautifulSoup
- import os, sys
- def htmlHandler(html_code, file):
- wof_file = open("wof_files/{0}".format(file), 'w')
- a = BeautifulSoup(html_code)
- [x.extract() for x in a.findAll('footer')]
- wof_file.write(str(a));
- wof_file.close()
- def fileHandler(dir):
- if not os.path.exists('wof_files'):
- os.mkdir('wof_files')
- htmlFiles = os.listdir(dir)
- for file in htmlFiles:
- htmlHandler(open(os.path.join(dir, file)).read(), file)
- def main():
- fileHandler(sys.argv[1])
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement