Ich habe mit diesem eine Zeitlang gekämpft. Ich versuche, Strings in HTML zu schreiben, habe aber Probleme mit dem Format, nachdem ich sie bereinigt habe. Hier ein Beispiel:Python HTML-Codierung xc2 xa0
paragraphs = ['Grocery giant and household name Woolworths is battered and bruised. ',
'But behind the problems are still the makings of a formidable company']
x = str(" ")
for item in paragraphs:
x = x + str(item)
x
Ausgang:
"Grocery giant and household name\xc2\xa0Woolworths is battered and\xc2\xa0bruised.
But behind the problems are still the makings of a formidable\xc2\xa0company"
gewünschte Ausgabe:
"Grocery giant and household name Woolworths is battered and bruised.
But behind the problems are still the makings of a formidable company"
Ich hoffe, Sie in der Lage zu erklären, warum dies geschieht und wie kann ich das beheben. Danke im Voraus!
Haben Sie in Ihrer Quellzeichenfolge nach ungewöhnlichen Unicode-Leerzeichen gesucht? –