Feb-21-2018, 04:36 PM
I'm very new to Python. I've studied a lot of books but putting all of it into practice is taxing to me. Any help you can provide is much appreciated!
When I run this...
I get this...
When I run this...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
from bs4 import BeautifulSoup import requests import re import urllib import zipfile import os apis = [ "49025219260000" , "49025059260000" , "49025206640000" , "49025203350000" , "49025213300000" , "49025061090000" , "49025062840000" , ] def wogcc_completions_scraper(): x = 0 while x < len (apis): print (apis[x]) print str (apis[x][ 3 : 10 ]) las_only = [] wogcc_request = requests.get(wogcc_url) soup = BeautifulSoup(wogcc_request.content, "html.parser" ) href_tags = soup.find_all( 'a' ) ### This section of code will data scrape the WOGCC for the completion reports completion_regex = """<td align="left" bgcolor="white" nowrap="" valign="Middle" width="450"><strong><font size="1">(.+?)</font></strong></td>""" completion_pattern = re. compile (completion_name_regex) completion_file = re.findall(completion_name_pattern, str (soup)) CNF = completion_name_file |
1 2 3 4 5 6 |
Traceback (most recent call last): File "C:\WOGCC Well Completions Scraper Lil Scraper 1.2b.py" , line 85 , in <module> wogcc_completions_scraper() File "C:\WOGCC Well Completions Scraper Lil Scraper 1.2b.py" , line 42 , in wogcc_completions_scraper completion_pattern = re. compile (completion_name_regex) NameError: global name 'completion_name_regex' is not defined |