0
input trailing newline [SOLVED]
any ideas on how to remove the trailing newline from the end of the input function? desirable output: >>> hello, Oki, nice to meet you. https://code.sololearn.com/c9Ov5eb70UBw/?ref=app
10 Answers
0
Cyan
i just came across this . problem solved!
https://code.sololearn.com/csF6ZQ27hvWo/?ref=app
+ 1
okidoki.jpeg I didn't know that. Thanks! âș
0
No you can't remove the trailing new line after the input() function as it does not have parameters unlike the "end" in print function.
You can just get the input then print the the input value with your desired text.
Your attempt 1 is working already just fine.
The interactive shell/prompt will look like this. Example if I want to input "spam".
>> spam
Hello, spam, nice to meet you.
0
is there any way i could view the code behind different functions?
like a more explicit version of the help function .
0
Read the Python Documentation for details.
https://www.python.org/doc/
0
#does something like this help?
name=input()
print(f"hello, {name}, how are you?")
0
Steven M
not particularly . the idea is to have the output print out fluidly without any breaks..
only prompt for the input when it's turn comes and only print it out once..
i hope this makes sense, it's 3am in South Africa right now .
0
Cyan
shweet, thanks . i'll give it a read .
0
Try if "\b" will work on your prompt. Because this is not working on most shell/prompt, but give it a try.
x = input()
print("\b Hello")
\b --> backspace
0
Cyan
interesting approach . it didn't work, unfortunately ..