Clear/overwrite standard output in Python
<p>Hi I'm trying to make a tic-tac-toe game in Python and I've run into a problem.</p>
<p><img src="https://i.stack.imgur.com/hvIIA.png" alt="1" /></p>
<p>As you can see on the picture it rewrites the playing board after input, what I want it to do is to clear the output and then rewrite the board. So instead of just printing new boards all the time it only clears the current board and rewrites it. I've searched on &quot;clear output&quot; etc, but found only these snippets:</p>
<pre class="lang-py prettyprint-override"><code>import os

clear = lambda: os.system('cls')
</code></pre>
<p>or</p>
<pre class="lang-py prettyprint-override"><code>import os

def clear():
    os.system('cls')
</code></pre>
<p>However, it doesn't work for me. It only returns this symbol: <img src="https://i.stack.imgur.com/2iFLF.png" alt="2" /></p>
<p>I am currently writing my code in PyCharm and just to make it clear, I want to keep it in PyCharm.</p>