PyQt5 QLabel() string contains < > [duplicate]
QLabels take HTML, so you can use html.escape
on the value you are interpolating:
self.label.setText(f'<font color = "#E4551F">{num}:</font> {html.escape(myString)}')
This will convert <
and >
to <
and >
. It will also make &
work correctly.