0
When I print and input, it always shows \n, is there a way to avoid it?
print ("What is your name?“ name = sys.stdin.readline() print ("Hello", name.capitalize) It shows me ('Hello', 'Paul\n') Is there no way it can print it without the " \n ", " ' " and " , " ?
3 Antworten
+ 2
use raw_input () instead of sys.stdin.readline ()
as sys.stdin.readline () does not strips the newline character '\n'
+ 2
for details you can read 'Rationale' section on
http://www.python.org/dev/peps/pep-3111/
+ 1
Okay thanks