Kalyan gave a possible way, but failed to explain the why.
When ask Python to print a list, it will output the start and end of list markers([]
) and a representation of all the items of the list. For a string, it means that non printable characters will be escaped.
There is little you can do except printing separately the items
for i lst:
print i
or build a unique string with join:
string_to_output = '[' + ', '.join(lst) + ']'
print(string_to_output)
By the way, as explained by Austin '\x01b[1m
is an sequence to ask an ANSI compatible terminal to pass in bold mode, so you must at a time revert to normal mode with '\x01b[0m
.
And remember: ANSI is common in Linux terminal emulations, but it is still far from being universal... Just try to use export TERM=tvi950
before using it (and google for vt100 and tvi950 to understand more)...