Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How do you clear the output in python 3?

+1 vote
asked Apr 12, 2022 by popstar403 (750 points)
I would like a way to clear the screen/terminal/output to make games in python 3

1 Answer

0 votes
answered Apr 13, 2022 by userdotexe (1,340 points)

There way I see it, there are 2 ways I think that are effective:

import os
os.system("clear||cls") # For clearing the current OS's (or online gdb's) output console


print("\033c",end='') # Uses octal escape sequence "c" to clear the terminal, without a newline

Hopefully that helps.


Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.