13 Answers
+ 18
#1:
from datetime import datetime
now = datetime.now()
print(now.hour,now.minute,now.second)
#2:
import os
print("stuff")
os.system('cls') #only works on windows I think. also won't work on Sololearn. there are other commands for other OS
#3:
import msvcrt
while True: #loop
if msvcrt.kbhit() == True: #if key is being pressed
keypress=str(msvcrt.getch()) #get key
if keypress == "b'c'":
print("sup bruhh")
#wont work on Sololearn. Might also be only Windows, but I'm not sure
#Another Question:
print(chr(87))
+ 14
updated my answer. check it out!
+ 13
@Mr.Coder Check out this!
https://code.sololearn.com/c7H53UlxtGNv/?ref=app
+ 8
Terminals either need ANSI Escape Sequences* (as visph describes in @Supersebi3's linked answer) or--if not in ANSI mode--a 'form feed', which is in the 'ASCII control characters':
chr(12)
Manually, you can test your terminal by pressing Ctrl+L (the 12th letter). Ctrl+A through Z map to control characters 1-26.
On Windows you may need to use echo (^ is Ctrl, echo is like print):
C:\>echo ^L
* ANSI escape codes start with chr(27), aka: Escape, aka: Ctrl+[ ... or the same code as the PC 'Esc key'.
+ 8
@Gami Thanks :D
+ 6
chr() makes numbers into ASCII
+ 6
print(chr(219))
+ 6
If you make a console application, you can use ANSI escape codes to clear the screen
For more info, read this:
https://www.sololearn.com/discuss/303028/?ref=app
+ 4
@Kuba Siekierzynski Oh yeah totally forgot I'm not on Ruby, thank you very much :D
+ 4
@Ahri Fox Thanks alot :D
+ 3
And Another Question:
How can I make numbers into ASCII ?
Please answer ASAP, thanks :D
+ 3
Thanks, what I meant about GetASyncKeyState is, it isa function which gets what you typed. for example you wrote a code where when you hit letter 'C' it will output "What bruh"
+ 3
@Kuba Siekierzynski Oh thank you :D so it is like:
print(219).chr() ?