Avatar ·

Korrekte Zeilenumbrüche in Python

📁 Liste, Python, Beispiel

Bitte sagen Sie mir, es gibt eine Liste mit Phrasen, aber sie sind lang und PEP8 beschwert sich über die Zeilenlänge.

Einen Teil der Phrase übertrage ich mit dem Symbol \, aber dann zählt er auch alle Leerzeichen.

Beispiel:

list_of_words = [""The weather is good."",                 ""Hot dog is the best food, \                 it would be a sure sign that it was still yummy."",                 ""The girls are beautiful."",                 ""Текст любой, не важно, но после бэкслэша огромное \                 расстояние между словами. Как это исправить?""]print(*list_of_words)

Ausgabe:

The weather is good. Hot dog is the best food,                  it would be a sure sign that it was still yummy. The girls are beautiful. Текст л