OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question : Input after all prompts in python


On Monday, June 11, 2018 at 9:13:04 PM UTC+8, Karsten Hilbert wrote:
> On Mon, Jun 11, 2018 at 02:52:53PM +0200, Peter Otten wrote:
> 
> > If the above hack works in the OP's environment it's certainly as easy as it 
> > can get; he just has to copy the up() and right() functions, and maybe adapt 
> > the arguments.
> > 
> > The learning curve for tkinter or curses is steep by comparison.
> 
> Agreed.
> 
> Note that I had a lurking suspicion this whole thing amounts
> to a homework assignment (which I didn't say, however) ... ;-)
> 
> Karsten
> --

Thanks all for your support,

I am a data storage admin by profession, starting to learn python as a hobby. I was just curious to learn this task, since this task is usually tricky in command prompt.

BTW i tried the code above, but i encountered a syntax error.

print(u"\u001b[{}A".format(n), flush=True, end="")
                                                     ^
SyntaxError :invalid syntax

I m trying this in a centos el7 bash terminal.
If i try running as
print(u"\u001b[{}A".format(n))
It works but the right function does not move the cursor right.

is it possible to achieve the same using sys.stdout.write.

Regards
Mohan C