aboutsummaryrefslogtreecommitdiffstats
path: root/bs_test.py
blob: 58b75299330bcfebaabfbe92d61e7f8a457be61d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import sys
import re

TOPIC_COUNT_RE = re.compile(r'\D+ \d+ - \d+ \D+ (\d+) \D+$')

bs = BeautifulSoup(open(sys.argv[1]))
i_str = bs.find_all('i')[0].string

print("i = {}".format(i_str))
count = int(TOPIC_COUNT_RE.match(i_str).group(1))
print("match i = {0:d}".format(count))