Linked Questions

2 votes
0 answers
5k views

I'm looking to print a dash "-" until the end of the user's screen. Basically my program would print a line of text and then a line of dashes beneath it and then another line of text. This would be ...
Adilicious's user avatar
  • 1,723
-1 votes
1 answer
101 views

I'm printing a title in python and I want it on the center of the screen. I know I can do it by using "{:^50}".format("Title") But the thing with this command is it only utilizes the width I give in ...
Krishh's user avatar
  • 667
0 votes
0 answers
103 views

I'm trying to find the width of the terminal window using python (3.8.2), so that I can store it in a variable. By doing this, I can centre text I display in the terminal, no matter the width of it. ...
440 votes
10 answers
277k views

As a simple example, I want to write a CLI script which can print = across the entire width of the terminal window. #!/usr/bin/env php <?php echo str_repeat('=', ???); or #!/usr/bin/env python ...
too much php's user avatar
  • 91.5k
47 votes
5 answers
27k views

import argparse parser = argparse.ArgumentParser(prog='tool') args = [('-u', '--upf', 'ref. upf', dict(required='True')), ('-s', '--skew', 'ref. skew', {}), ('-m', '--model', 'ref. ...
13 votes
4 answers
13k views

I'm trying to let the user input commands at a console using raw_input(), this works fine. The problem is I have background threads that occasionally output log-information to the screen and when they ...
Jim's user avatar
  • 133
16 votes
1 answer
13k views

I want to get the size of the terminal. I am using this functionality: import sys, struct, fcntl, termios s = struct.pack('HHHH', 0, 0, 0, 0) t = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ,...
William's user avatar
  • 3,045
11 votes
2 answers
11k views

I want to fill an entire line in the screen with * characters and stop just before break line? Something like this ********** MENU ********** Thanks
9 votes
5 answers
21k views

Suppose I have these two lists: column1 = ["soft","pregnant","tall"] column2 = ["skin","woman", "man"] How do I loop print through these two lists while using a custom, fixed space(say 10, as in ...
4 votes
3 answers
6k views

I've seen a question on justifying a 'print' right, but could I have text left and right on the same line, for a --help? It'd look like this in the terminal: | ...
tkbx's user avatar
  • 16.4k
6 votes
3 answers
3k views

I am writing a Python script to print out displayable user interface. The problem is every Linux user would have their own unique terminal size. This will cause the hard-coded user interface to go out ...
Ezylryb's user avatar
  • 673
6 votes
2 answers
4k views

I am looking at some source-code from a book and noticed that some of the code does not seem to be in the current Python2.7 API. The module curses is, according to this code, supposed to have a ...
1 vote
2 answers
9k views

I tried the following code s='Python is an interpreted high-level programming language for general-purpose programming. Created by Guido van Rossum and first released in 1991, Python has a design ...
Sushruth N's user avatar
4 votes
2 answers
2k views

Normally print ("{}".foo, end="\r") works well. But the exception is when foo is long, and next time foo becomes short. The output becomes incorrect. Below is an example: import time print ("{}"....
lesca's user avatar
  • 429
1 vote
4 answers
2k views

I'm coding a very small and basic text based adventure game in python, and I want to be able to align my title (which is in ASCII) I've looked it up but I either didn't understand it or it didn't work....

15 30 50 per page
1
2 3