Q:

Python PyQt5 QTextBrowser hyperlink loses part of link

Hi i have a small problem with hyperlink in QTextBrowser.
I create links with this code with ID from json parsing:
ID = data["response"]["recordings"][0]["id"]
aLink = " <a href=http://***/archive/edit?id=%s>%s</a>" % (ID, ID)

print(aLink)

When i print link i get:
<a href=http://***/archive/edit?id=17452>17452</a>

The problem is that when i use this to create hyperlink in QTextBrowser, the link is created but it holds only this:
http://***/archive/edit?id

Somehow i loose this part of code "=17452" when i append link to QtextBrowser
self.textBrowser.append(aLink)

Any ideas?

A:

You have to set the quotes:
<a href='some-url'> some-text</a>
        ^        ^
        |-quotes-|

Example:
import sys

from PyQt5.QtWidgets import *

app = QApplication(sys.argv)
ID = 17452
aLink = " <a href='http://***/archive/edit?id=%s'>%s</a>" % (ID, ID)
w = QTextBrowser()
w.append(aLink)
w.show()

sys.exit(app.exec_())

