python - Output on same line after input call -


i want input , print output on same line. attempt doesn't work.

while true:     op = input("input: ")     print("\toutput: " + op) 

the output looks this:

input:     output:a input: cat     output cat input: 32     output: 32 

i this:

input:     output: input cat    output: cat input: 32    output: 32 

is possible in python? require overwriting line of output, don't know whether it's possible, or how it.

this depends on binding stdout , stdin (the default output , input channels). crux of problem user has hit "enter" submit input, , bound cr/lf pair. if i/o device enabled moving back 1 line, can print character, reprint input, , print output.

without knowing device or characteristics, can't give actual code. check friendly neighborhood documentation appropriate control characters.


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -