python 如何抽取Excel中的超链接的地址?
时间:2011-04-20
来源:互联网
本帖最后由 tommydu 于 2011-04-20 10:10 编辑
请教大家个问题:python 如何抽取Excel中的超链接的地址?
这里http://www.numbergrinder.com/200 ... -using-python-xlrd/ 说python-xlrd不支持这个需求?
有什么办法吗?谢谢!
请教大家个问题:python 如何抽取Excel中的超链接的地址?
这里http://www.numbergrinder.com/200 ... -using-python-xlrd/ 说python-xlrd不支持这个需求?
有什么办法吗?谢谢!
作者: tommydu 发布时间: 2011-04-20
SVN URL: https://secure.simplistix.co.uk/svn/xlrd/trunk
revision: 4774 ***CHANGED*** (bug fix needed)
Installation: cd to your checkout directory and do /wherever/it/is/python setup.py install
sample xls file: attached
sample interactive session:
>>> import xlrd
>>> b = xlrd.open_workbook('hlink_example.xls')
>>> s = b.sheet_by_index(0)
>>> len(s.hyperlink_list)
9
>>> for h in s.hyperlink_list:
... h.dump(header = 60 * '-')
...
------------------------------------------------------------
desc: u'example description (e-mail)'
fcolx: 1
frowx: 1
lcolx: 1
lrowx: 1
type: u'url'
url_or_path: u'mailto:[email protected]?subject=xlrd%20better%20than%20sliced%20bread%20and%20WD40'
------------------------------------------------------------
desc: u'python.org website'
fcolx: 1
frowx: 2
lcolx: 1
lrowx: 2
type: u'url'
url_or_path: u'http://www.python.org/'
------------------------------------------------------------
desc: u'top left cell in 2nd sheet'
fcolx: 1
frowx: 3
lcolx: 1
lrowx: 3
textmark: u'Sheet2!A1'
type: u'workbook'
------------------------------------------------------------
desc: u'sample local file'
fcolx: 1
frowx: 4
lcolx: 1
lrowx: 4
type: u'local file'
url_or_path: 'dummy.txt'
------------------------------------------------------------
desc: u'desc of UNC file'
fcolx: 1
frowx: 5
lcolx: 1
lrowx: 5
type: u'unc'
url_or_path: u'\\\\MACHINENAME\\c:\\xlrd\\hyperlinks\\dummy.txt'
------------------------------------------------------------
desc: u'struct format parameters'
fcolx: 1
frowx: 6
lcolx: 1
lrowx: 6
textmark: u'format-characters'
type: u'url'
url_or_path: u'http://docs.python.org/library/struct.html'
------------------------------------------------------------
desc: u'4th char of name is U+00E4'
fcolx: 1
frowx: 7
lcolx: 1
lrowx: 7
type: u'local file'
url_or_path: u'fub\xe4r.txt'
------------------------------------------------------------
desc: u'Sheet3!A1:Z99'
fcolx: 1
frowx: 8
lcolx: 1
lrowx: 8
textmark: u'Sheet3!A1:Z99'
type: u'workbook'
------------------------------------------------------------
desc: u'http://www.foo.com'
fcolx: 1
frowx: 9
lcolx: 1
lrowx: 9
type: u'url'
url_or_path: u'http://www.foo.com/'
hlink_example.zip (2.71 KB)
revision: 4774 ***CHANGED*** (bug fix needed)
Installation: cd to your checkout directory and do /wherever/it/is/python setup.py install
sample xls file: attached
sample interactive session:
>>> import xlrd
>>> b = xlrd.open_workbook('hlink_example.xls')
>>> s = b.sheet_by_index(0)
>>> len(s.hyperlink_list)
9
>>> for h in s.hyperlink_list:
... h.dump(header = 60 * '-')
...
------------------------------------------------------------
desc: u'example description (e-mail)'
fcolx: 1
frowx: 1
lcolx: 1
lrowx: 1
type: u'url'
url_or_path: u'mailto:[email protected]?subject=xlrd%20better%20than%20sliced%20bread%20and%20WD40'
------------------------------------------------------------
desc: u'python.org website'
fcolx: 1
frowx: 2
lcolx: 1
lrowx: 2
type: u'url'
url_or_path: u'http://www.python.org/'
------------------------------------------------------------
desc: u'top left cell in 2nd sheet'
fcolx: 1
frowx: 3
lcolx: 1
lrowx: 3
textmark: u'Sheet2!A1'
type: u'workbook'
------------------------------------------------------------
desc: u'sample local file'
fcolx: 1
frowx: 4
lcolx: 1
lrowx: 4
type: u'local file'
url_or_path: 'dummy.txt'
------------------------------------------------------------
desc: u'desc of UNC file'
fcolx: 1
frowx: 5
lcolx: 1
lrowx: 5
type: u'unc'
url_or_path: u'\\\\MACHINENAME\\c:\\xlrd\\hyperlinks\\dummy.txt'
------------------------------------------------------------
desc: u'struct format parameters'
fcolx: 1
frowx: 6
lcolx: 1
lrowx: 6
textmark: u'format-characters'
type: u'url'
url_or_path: u'http://docs.python.org/library/struct.html'
------------------------------------------------------------
desc: u'4th char of name is U+00E4'
fcolx: 1
frowx: 7
lcolx: 1
lrowx: 7
type: u'local file'
url_or_path: u'fub\xe4r.txt'
------------------------------------------------------------
desc: u'Sheet3!A1:Z99'
fcolx: 1
frowx: 8
lcolx: 1
lrowx: 8
textmark: u'Sheet3!A1:Z99'
type: u'workbook'
------------------------------------------------------------
desc: u'http://www.foo.com'
fcolx: 1
frowx: 9
lcolx: 1
lrowx: 9
type: u'url'
url_or_path: u'http://www.foo.com/'

作者: tommydu 发布时间: 2011-04-21
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28