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

30th Jan 2021, 12:18 AM
sonofpeter.exe
sonofpeter.exe - avatar
10 Antworten
0
Cyan i just came across this . problem solved! https://code.sololearn.com/csF6ZQ27hvWo/?ref=app
30th Jan 2021, 2:23 AM
sonofpeter.exe
sonofpeter.exe - avatar
+ 1
okidoki.jpeg I didn't know that. Thanks! ☺
30th Jan 2021, 2:24 AM
noteve
noteve - avatar
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.
30th Jan 2021, 12:45 AM
noteve
noteve - avatar
0
is there any way i could view the code behind different functions? like a more explicit version of the help function .
30th Jan 2021, 12:59 AM
sonofpeter.exe
sonofpeter.exe - avatar
0
Read the Python Documentation for details. https://www.python.org/doc/
30th Jan 2021, 1:01 AM
noteve
noteve - avatar
0
#does something like this help? name=input() print(f"hello, {name}, how are you?")
30th Jan 2021, 1:04 AM
Steven M
Steven M - avatar
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 .
30th Jan 2021, 1:13 AM
sonofpeter.exe
sonofpeter.exe - avatar
0
Cyan shweet, thanks . i'll give it a read .
30th Jan 2021, 1:16 AM
sonofpeter.exe
sonofpeter.exe - avatar
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
30th Jan 2021, 1:17 AM
noteve
noteve - avatar
0
Cyan interesting approach . it didn't work, unfortunately ..
30th Jan 2021, 1:39 AM
sonofpeter.exe
sonofpeter.exe - avatar