I am trying to print a horizontal line in python. basically I want to print:
actual
"----------"
Expected
but I want the '----' to be continuous. Any suggestions?
I am trying to print a horizontal line in python. basically I want to print:
actual
"----------"
Expected
but I want the '----' to be continuous. Any suggestions?
Try printing out using the following:
print('─' * 10) # U+2500, Box Drawings Light Horizontal
print('─' * 10) # U+2501, Box Drawings Heavy Horizontal
print('―' * 10) # U+2015, Horizontal Bar
print('_' * 10) # Underscore
Output
────────── U+2500, Box Drawings Light Horizontal
────────── U+2501, Box Drawings Heavy Horizontal
―――――――――― U+2015, Horizontal Bar
__________ Underscore
Take a look at the Box-drawing character Wikipedia page for more bars you can use
If you would like to print a horizontal line across the terminal the width of the terminal, you can use:
import os
term_size = os.get_terminal_size()
print('=' * term_size.columns)
You could try printing extended ASCII characters as in the below example. Here the ASCII value u'\u2500' relates to hyphen without spaces at start and end. The \u specifies the following string is in extended ASCII form and 2500 denotes the ─ symbol.
print(u'\u2500' * 10)
Result
──────────