Hướng dẫn print horizontal line python
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? asked Jan 4, 2021 at 10:39
4 Try printing out using the following:
Output
Take a look at the Box-drawing character Wikipedia page for more bars you can use answered Jan 4, 2021 at 10:50
1 If you would like to print a horizontal line across the terminal the width of the terminal, you can use:
answered May 21, 2021 at 18:53
1 You could try printing extended ASCII characters as in the below example.
Here the ASCII value
Result
answered Jan 4, 2021 at 10:55
SwadhikarSwadhikar 2,0131 gold badge18 silver badges32 bronze badges 5 Print a horizontal line in Python #To print a horizontal line:
The examples use the multiplication operator to print a horizontal line. When the multiplication operator is used with a string and an integer, the string is repeated the specified number of times.
You can use this approach to print a horizontal line that consists of any character. If you need to print the items in an
iterable horizontally, set the
The By default,
Alternatively, you can use the iterable unpacking operator.
The * iterable unpacking operator enables us to unpack an iterable in function calls, in comprehensions and in generator expressions. You can use this approach to print the items of an iterable with any separator, it doesn't have to be a space.
The By default, the argument is set to a space. |