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

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -