MFB
MFB

Reputation: 19817

What does '[A' do in a print command?

I have seen this '[A' in a progress bar module but I can't figure out what it does.

As in:

print '[]', chr(27) + '[A'

Do you know what it does??

Upvotes: 1

Views: 195

Answers (2)

Dave
Dave

Reputation: 11162

It's a VT100 Escape sequence; it moves the cursor up.

Note that the chr(27) initiates the sequence. Often, this might be written"\033[A" (since 33oct == 27dec). If you've ever added color to a bash prompt, you've seen this.

Upvotes: 6

Kaz
Kaz

Reputation: 58627

VT100 escape sequence.

ESC[<value>A moves the cursor up <value> lines. It looks like if <value> is omitted it defaults to one line.

Upvotes: 0

Related Questions