Foppe Hemminga 6 лет назад
Родитель
Сommit
359b305342
1 измененных файлов с 10 добавлено и 9 удалено
  1. 10 9
      _bs.py

+ 10 - 9
_bs.py

@@ -153,6 +153,7 @@ def scrape_scratchings(div, this_venue):
                 print('First character in line: {}'.format(text[0]))
                 print('The start of the offending line is: {}'.format(text[0:10]))
                 continue
+            text = re.sub(r'e\s+', ' ', text)
             temp_list = Scratching(this_venue.name, this_venue.state, this_venue.date, race, text)
             scraped_scratchings.append(temp_list)
     return scraped_scratchings
@@ -175,15 +176,15 @@ def process_scratchings(this_data, this_venue):
     header = this_scr.findAll('h3', text=re.compile('Late Scratchings'))[0]
     late_div = header.findNext('table')
     late_scratchings = scrape_scratchings(late_div, this_venue)
-    if this_venue.name == 'Corowa':
-        pprint(late_div)
-        pprint(late_scratchings)
+    # if this_venue.name == 'Corowa':
+    #      pprint(late_div)
+    #     pprint(late_scratchings)
     scratchings.update(late_scratchings)
 
-    # assert len(scratchings) == int(scratchings_count), 'len(scratchings) {} == scratchings_count {}'.format(
-    #     len(scratchings), scratchings_count)
-    if len(scratchings) != int(scratchings_count):
-        print('len(scratchings) {} == scratchings_count {}'.format(
-            len(scratchings), scratchings_count))
-        pprint(scratchings)
+    assert len(scratchings) == int(scratchings_count), 'len(scratchings) {} == scratchings_count {}'.format(
+        len(scratchings), scratchings_count)
+    # if len(scratchings) != int(scratchings_count):
+    #    print('len(scratchings) {} == scratchings_count {}'.format(
+    #        len(scratchings), scratchings_count))
+    #    pprint(scratchings)
     return scratchings