how to clear the entire stdout? [duplicate] - python

This question already has answers here:
Clear terminal in Python [duplicate]
(27 answers)
How can I clear console
(19 answers)
Closed 7 years ago.
I want to print some strings in more than one line and then clear it and overwrite some other strings in stdout.
I know about \r to return and overwrite the current line, but I want to clear every lines in stdout.
and I also know about os.system('clear') to clear the screan but I don't want to clear the whole screen because it clears everything including the commands has been run before running this script and shell statuses.

You're going to have to use the curses package for this sort of thing.

Related

Clear the Python shell window [duplicate]

This question already has answers here:
how to clear the screen in python [duplicate]
(1 answer)
How to clear the interpreter console?
(31 answers)
Closed 3 years ago.
I'm trying to clear the shell window when the actual code runs. I've done a couple different searches and saw some options but none seem to work. Here is the one I've been trying to get to work (I'm using Python 3.8.1).
import os
os.system('cls')

How do I clear the output screen in python? [duplicate]

This question already has answers here:
Clear terminal in Python [duplicate]
(27 answers)
Closed 4 years ago.
I am making a text based rpg in python 3 and the output window gets very cluttered cluttered. I was wondering if there was a way to clear the screen automatically from time to time.
import os
os.system('cls')
You can use os.system('clear') if you are on linux.

How do I store data that it is inputted forever? [duplicate]

This question already has answers here:
How to save a dictionary to a file?
(12 answers)
Closed 5 years ago.
I want to take an input from someone and save it in a dictionary even after I end the program so that I can run it again and retrieve the information. How do I do this?
You need to save the information to a file or database when the program ends and reload it when it starts. Pickle is one way you can do that.

Go to line python [duplicate]

This question already has answers here:
Is there a label/goto in Python?
(22 answers)
Closed 9 years ago.
I want my program to go to a certain line in the program which is running when it I needed to and run from there. Is this possible and if so How can this be done?
Put whatever lines you want to be done in a function, then put the function call where you want. Goto is bad form in any language, and it doesn't exist in Python.
If you think your code is too short to warrant a full function, you can use a lambda function (but those can be tricky).

Is there anyway to use python to take a snapshot [duplicate]

This question already has answers here:
Get screenshot on Windows with Python?
(9 answers)
Closed 9 years ago.
Im working on a program and i was wondering if i can use python to snapshot my screen and possibly save it on my computer ?
If you are using Windows, ImageGrab looks like it would work (http://effbot.org/imagingbook/imagegrab.htm).

Categories

Resources