1

So I have an odd bug which instead of making console clear writes that character.
That issue doesn't occur in C, and everything works normally when I write cls in command prompt window. (I am not an advanced programmer, but I suppose that system() is related with it.)

Edit: (When I use clear, it does completely nothing.) Perhaps that problem is not related to wrong keyword (I use Windows), it just didn't do what I was expecting because of drawing that weird arrow character.

Edit2: I reinstalled whole vs with phyton, and it doesn't worked

Edit3: resolved : "Windows Command Prompt shortcut doesn't work correctly (Ctrl + L)

[image]

from os import system

while True :
    print(" #")
    system("cls")
VEVE
  • 27
  • 1
  • 3
  • 1
    Is there some redirection/piping involved in your code? As far as I remember, the DOS/Windows `cls` command just sends the form-feed character (FF, `0x0C`) to the console, which might become translated into something else in case… – aschipfl Oct 03 '20 at 19:18

1 Answers1

1

try this function to clear the screen regardless of OS

from os import system, name 
def clear(): 
    if name == 'nt': 
        x = system('cls') 
    else: 
        x = system('clear') 

or you could try using subprocess:

from subprocess import call 
  
def clear(): 
    x = call('clear' if os.name =='posix' else 'cls') 

Other than that I think it would be some problem with your terminal

Ironkey
  • 2,568
  • 1
  • 8
  • 30
  • it doesn't work, now I explained more in description – VEVE Oct 03 '20 at 18:16
  • [WinError 2] The system cannot find the file specified – VEVE Oct 03 '20 at 22:07
  • in that case, I have no idea, both of the above work for me, maybe try reinstalling, or try toying with the escape characters, this question shouldn't have been closed. – Ironkey Oct 03 '20 at 22:10