ERLEDIGT
NEIN
NEIN
ANTWORTEN
2
2
ZUGRIFFE
1056
1056
EMPFEHLEN
-
Hallo bin Newbie ,bei dem script werden die Buchstaben untereinander bei Python Version 3.2
und bei Python Version 2.5 nebeneinander ausgeben,was muss ich ändern um es auch der 3.2 version genauso hinzubekommen?
for buchstabe in ['h','e','l','l','o',' ','w','o','r','l','d']:
print (buchstabe),
-
06.08.11 22:15 #2
- Registriert seit
- Jun 2005
- Beiträge
- 8.168
Hi.
http://docs.python.org/release/3.0.1/whatsnew/3.0.html
Bitte verwende die Code-Tags für Codeschnipsel!The print statement has been replaced with a print() function, with keyword arguments to replace most of the special syntax of the old print statement (PEP 3105). Examples:
Old: print "The answer is", 2*2
New: print("The answer is", 2*2)
Old: print x, # Trailing comma suppresses newline
New: print(x, end=" ") # Appends a space instead of a newline
Old: print # Prints a newline
New: print() # You must call the function!
Old: print >>sys.stderr, "fatal error"
New: print("fatal error", file=sys.stderr)
Old: print (x, y) # prints repr((x, y))
New: print((x, y)) # Not the same as print(x, y)!
Und die Schreibweise als String ist evlt. schöner anzuschauen:
GrußCode python:1 2
for buchstabe in "hello world": print(buchstabe, end=" ")
If at first you don't succeed, try again. Then quit. No use being a damn fool about it.
-
Hallo ,natürlich ist ein string schöner und einfacher,es geht ums debuggen(tracen) der zeile!
Werd mir mal die Neuerungen genauer ansehen!
Ähnliche Themen
-
\n \t werden ausgegeben anstatt von Zeilenumbruch und tab
Von Noeden im Forum PHPAntworten: 4Letzter Beitrag: 13.05.11, 15:33 -
DIVs nebeneinander und untereinander wie collapsible tabelle
Von kharn im Forum CSSAntworten: 1Letzter Beitrag: 27.05.10, 15:44 -
Buttons untereinander - anstatt nebeneinander
Von mkoeni1 im Forum JavaAntworten: 4Letzter Beitrag: 09.11.05, 22:21 -
Ergebnisse nebeneinander statt untereinander
Von bunitz im Forum PHPAntworten: 2Letzter Beitrag: 22.07.05, 12:56 -
Random Funktion, anstatt Bild wird Bildname ausgegeben...
Von versuch13 im Forum PHPAntworten: 8Letzter Beitrag: 07.03.05, 18:20





Zitieren
Login





