url = QUrl("https://www.example.com/path/file.html") display_str = url.toDisplayString() print(display_str)
https://www.example.com/path/file.html
url = QUrl("ftp://ftp.example.com/pub/files/") display_str = url.toDisplayString() print(display_str)
ftp://ftp.example.com/pub/files/In both examples, the toDisplayString method is called on a QUrl object, and the resulting string is printed to the console. Overall, the PyQt5.QtCore.QUrl module is a useful tool for working with URLs in a Python application.