Python 如何使用变量在QLabel中嵌入url链接
目前,下面的代码工作,但我不想超链接带我到谷歌.com。我想让它把我带到可变拖车内的链接。有人能给我一个建议吗Python 如何使用变量在QLabel中嵌入url链接,python,web-scraping,beautifulsoup,pyqt,Python,Web Scraping,Beautifulsoup,Pyqt,目前,下面的代码工作,但我不想超链接带我到谷歌.com。我想让它把我带到可变拖车内的链接。有人能给我一个建议吗 trailers = page_soup.findAll("a",{"class":"slate_button prevent-ad-overlay video-modal"})[0]["href"] imdbBase = "http://www.imdb.com" trailer = imdbBase + trailers urlLink=" <a href=\"http://
trailers = page_soup.findAll("a",{"class":"slate_button prevent-ad-overlay video-modal"})[0]["href"]
imdbBase = "http://www.imdb.com"
trailer = imdbBase + trailers
urlLink=" <a href=\"http://www.google.com\"> <font face=Tw Cen MT Condensed size=2 color=black>Watch Trailer</font> </a>"
trailer_lbl = self.edit_trailer
self.edit_trailer.setText(urlLink)
self.edit_trailer.setOpenExternalLinks(True)
trailes=page_soup.findAll(“a”,{“类”:“slate_按钮防止广告覆盖视频模式”})[0][“href”]
imdbBase=”http://www.imdb.com"
拖车=imdbBase+拖车
urlink=“”
拖车_lbl=自我编辑_拖车
self.edit_trail.setText(urlink)
self.edit_trail.setOpenExternalinks(真)
打印结果(拖车)
要能够连接url,可以使用
格式
:
trailers = "/video/imdb/vi38776120057?playlistId=tt0111161&ref=tt_ov_vi"
imdbBase = "http://www.imdb.com"
trailer = imdbBase + trailers
urlLink=" <a href=\"{url}\"> <font face=Tw Cen MT Condensed size=2 color=black>Watch Trailer</font> </a>".format(url=trailer)
trailer_lbl = QtWidgets.QLabel()
trailer_lbl.setText(urlLink)
trailer_lbl.setOpenExternalLinks(True)
trailes=“/video/imdb/vi38776120057?playlid=tt01111161&ref=tt_ov_vi”
imdbBase=”http://www.imdb.com"
拖车=imdbBase+拖车
urlLink=“”.格式(url=拖车)
trailer\u lbl=qtwidts.QLabel()
拖车_lbl.setText(URL链接)
拖车安装开启器外挂(正确)
要能够连接url,可以使用格式
:
trailers = "/video/imdb/vi38776120057?playlistId=tt0111161&ref=tt_ov_vi"
imdbBase = "http://www.imdb.com"
trailer = imdbBase + trailers
urlLink=" <a href=\"{url}\"> <font face=Tw Cen MT Condensed size=2 color=black>Watch Trailer</font> </a>".format(url=trailer)
trailer_lbl = QtWidgets.QLabel()
trailer_lbl.setText(urlLink)
trailer_lbl.setOpenExternalLinks(True)
trailes=“/video/imdb/vi38776120057?playlid=tt01111161&ref=tt_ov_vi”
imdbBase=”http://www.imdb.com"
拖车=imdbBase+拖车
urlLink=“”.格式(url=拖车)
trailer\u lbl=qtwidts.QLabel()
拖车_lbl.setText(URL链接)
拖车安装开启器外挂(正确)
trailes返回一个字符串。预告片是预告片和IMDBBASE的串联,非常感谢。我真的很感谢你的帮助。是的,它奏效了。Thankstrailers返回一个字符串。预告片是预告片和IMDBBASE的串联,非常感谢。我真的很感谢你的帮助。是的,它奏效了。谢谢