Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用python从excel工作表中提取超链接单元格_Python_Python 2.7_Python 3.x_Xlrd_Xlwt - Fatal编程技术网

如何使用python从excel工作表中提取超链接单元格

如何使用python从excel工作表中提取超链接单元格,python,python-2.7,python-3.x,xlrd,xlwt,Python,Python 2.7,Python 3.x,Xlrd,Xlwt,我正在尝试打开excel电子表格中各个单元格的超链接。这是我尝试的代码 import xlrd import logging wb=xlrd.open_workbook("hhh.xls") sh=wb.sheet_by_index(3) wsname=[] for row in range(sh.nrows): if sh.cell_value(row,15)=="Table": print sh.cell_value(row,15) print sh.

我正在尝试打开excel电子表格中各个单元格的超链接。这是我尝试的代码

import xlrd
import logging
wb=xlrd.open_workbook("hhh.xls")
sh=wb.sheet_by_index(3)
wsname=[]
for row in range(sh.nrows):
    if sh.cell_value(row,15)=="Table":
        print sh.cell_value(row,15)
        print sh.cell_value(row,2)

        link =sh.hyperlink_map.get(row,2)
        url='(No URL)' if link is None else link.url_or_path
        wsname = link.textmark.split('!')[0]
        logging.debug("link=%s wsname=%s" % (link.textmark, wsname))
        wstable=wb.sheet_by_name(wsname)
请帮我解决这个问题 这就是错误所在

回溯最近一次呼叫上次: 文件reading.py,第12行,在 url='No url'如果链接不是其他链接。url\u或\u路径 AttributeError:“int”对象没有属性“url\u或\u路径”

帮助……。

从中,您需要传入一个元组:


你好,burhan,我试过了,请检查代码是否正常工作。我想从excel工作表中打开特定的单元格超链接。有没有其他方法你没有尝试过-看看你的代码,然后看看我的代码片段。你能给我你的邮件id吗。请因为我在python excel中工作,所以如果我有疑问,请你帮助我。
link = sh.hyperlink_map.get((row,2))