Ich versuche, eine URL aus dem Web zu packen, aber egal was ich tue, es druckt auch das gesamte Modul für die QUrl:PyQt5: Wie ein QUrl ohne die Modulnamen drucken
import sys
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebEngineWidgets import QWebEngineView
app = QApplication(sys.argv)
url = 'http://stackoverflow.com'
wv = QWebEngineView()
wv.load(QUrl(url))
print str(QUrl(url))
wv.show()
app.exec_()
der gibt mir:
PyQt5.QtCore.QUrl(u'http://stackoverflow.com')
ich bin nur daran interessiert, die Unicode-String, ohne den Modulnamen Grabbing:
u'http://stackoverflow.com'
I k Jetzt kann ich nur die URL ausdrucken, aber das ist nur für das Reproduzieren des Problems in einer größeren App.
danke, es hat funktioniert. u = QUrl (QUrl ((url))) drucken u.toString() –