In [1]:
import os

In [2]:
from bs4 import BeautifulSoup

In [3]:
import mnc

In [4]:
mnc.data[0]['operator']


Out[4]:
'EE'

In [5]:
[(k, mnc.data[0][k]) for k in mnc.data[0] if k.endswith('.score')]


Out[5]:
[('4G.score', 100),
 ('voicemail.score', 300),
 ('sms_other.score', 120),
 ('min_other.score', 300),
 ('min_same.score', 300),
 ('charge_min.score', 300),
 ('tether.score', 100),
 ('min_land.score', 300),
 ('sms_same.score', 120),
 ('data.score', 1000),
 ('bill_per.score', 200),
 ('mms.score', 400),
 ('08x.score', 440)]

In [6]:
mnc_data = mnc.MncData()

In [7]:
mnc_data.plans[:4]


Out[7]:
['o2', 'orange', '3', 't-mobile']

In [8]:
mnc_data.populate()

In [9]:
mnc_map = mnc.Map()

In [10]:
for x, y in mnc_map.active_mnc2payg.items():
    if mnc_data.call[x] != str(mnc.data[y]['min_other']) + 'p':
        print(mnc_data.call[x], str(mnc.data[y]['min_other']) + 'p', x)

In [11]:
for x, y in mnc_map.active_mnc2payg.items():
    if mnc_data.text[x] != str(mnc.data[y]['sms_other']) + 'p':
        print(mnc_data.text[x], str(mnc.data[y]['sms_other']) + 'p', x)

In [12]:
len(mnc_map.active_mnc2payg)


Out[12]:
24

In [13]:
len(mnc_map.defunct)


Out[13]:
30

In [14]:
for x, y in mnc_map.active_mnc2payg.items():
    if mnc_data.text[x] != str(mnc.data[y]['sms_other']) + 'p':
        print(mnc_data.text[x], str(mnc.data[y]['sms_other']) + 'p', x)

In [15]:
len(mnc_data.all)


Out[15]:
276

In [16]:
with open(os.path.expanduser('~/Downloads/PAYG/MNC/comparison table 002.html')) as f:
    soup = BeautifulSoup(f, 'html.parser')

In [17]:
calls = soup.find_all('td', 'calls')

In [18]:
len(calls)


Out[18]:
50

In [19]:
calls[0].text


Out[19]:
':ggcalls: ((But always free to Giffgaff (if you topped-up within the last three months).))'

In [20]:
ggcalls = calls[0]

In [21]:
ggcalls.parent.find('td', 'network').text


Out[21]:
':gg: ((Operated by O2.))'

In [22]:
str(ggcalls.parent.find('td', 'network')).split(':')[1]


Out[22]:
'gg'

In [25]:
[str(c.parent.find('td', 'network')).split(':')[1] for c in calls if 'TalkMobile' not in str(c)]


---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-25-a227d541efbf> in <module>()
----> 1 [str(c.parent.find('td', 'network')).split(':')[1] for c in calls if 'TalkMobile' not in str(c)]

<ipython-input-25-a227d541efbf> in <listcomp>(.0)
----> 1 [str(c.parent.find('td', 'network')).split(':')[1] for c in calls if 'TalkMobile' not in str(c)]

IndexError: list index out of range

In [26]:
%debug


> <ipython-input-25-a227d541efbf>(1)<listcomp>()
----> 1 [str(c.parent.find('td', 'network')).split(':')[1] for c in calls if 'TalkMobile' not in str(c)]

ipdb> p c
<td class="calls">:sainsburyscalls:</td>
ipdb> q