Reputation: 1043
I want to make the output to look like this:
******************
Enter your age:
******************
But the input would appear in the middle of the strings. eg.
******************
Enter your age: 15
******************
Is it possible to get this done by using Python 2.7.12?
Upvotes: 0
Views: 1184
Reputation: 1043
Based on this answer, What can I use to go one line break back in a terminal in Python?, it is really terminal-dependent. I have tried on the console of Windows 10, and it seems that this is not possible.
However, it is possible to move the cursor one character before/after another on the same line using the escape character \b
Upvotes: 1
Reputation: 115
You could use:
age = 15
print "******************"
print "Enter your age: %s" % age
print "******************"
Either that, or:
age = 15
print "******************Enter your age: %s******************" % age
I'm guessing it's the first version, but your syntax of the question is wrong, the two options look the same.
Upvotes: 0