In [1]: import pandas as pd
In [2]: df = pd.DataFrame({'raw': ['1,2,3', '3,4,5']})
In [3]: df
Out[3]:
raw
0 1,2,3
1 3,4,5
In [4]: df['col1']=df['raw'].str.split(',').str.get(0)
In [5]: df['col2']=df['raw'].str.split(',').str.get(1)
In [6]: df['col3']=df['raw'].str.split(',').str.get(2)
In [7]: df
Out[7]:
raw col1 col2 col3
0 1,2,3 1 2 3
1 3,4,5 3 4 5
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
import urllib.request
from lxml import etree
url = 'http://myip.ru/'
query = '//*/table[@class="network-info"]'
parser = etree.HTMLParser()
req = urllib.request.urlopen(url)
tree = etree.parse(req, parser)
tbl = tree.xpath(query)
print(tbl[0][1][0].text)