Python---Warum werden die Buchstaben untereinander anstatt nebeneinander ausgegeben?

bigfish42

Grünschnabel
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),
 
Hi.

http://docs.python.org/release/3.0.1/whatsnew/3.0.html
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)!
Bitte verwende die Code-Tags für Codeschnipsel!

Und die Schreibweise als String ist evlt. schöner anzuschauen:
Python:
for buchstabe in "hello world":
  print(buchstabe, end=" ")
Gruß
 
Hallo ,natürlich ist ein string schöner und einfacher,es geht ums debuggen(tracen) der zeile!
Werd mir mal die Neuerungen genauer ansehen!
 
Zurück