0

I want python to take in input then print out the input with added characters in front without outputting the original input.

Example:

foo = input("")
print("Me: " + foo)

should output

Me: foo

instead of

foo
Me: foo

I can't just do input("Foo: ") as there are other threads outputting to the console and they mess up the formatting.

2

1 Answer 1

0

You can use a Erase Line string to clear the line above:

foo = input("")
print("\033[2K\033[1AMe: " + foo)

This clears the foo As well as the newline

Me: foo
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.