From 62014797314006dc8c6824a2464a161bc61f3eb5 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Sun, 7 Mar 2021 23:49:49 -0500 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E5=86=99=E5=8F=98=E9=87=8F=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/CleanScreen.py | 29 +++++++++++++++++++++++++++++ tests/Variables.py | 8 +++++--- 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 tests/CleanScreen.py diff --git a/tests/CleanScreen.py b/tests/CleanScreen.py new file mode 100644 index 0000000..80714ef --- /dev/null +++ b/tests/CleanScreen.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +# import only system from os +from os import system, name + +# import sleep to show output for some time period +from time import sleep + + +# define our clear function +def clear(): + # for windows + if name == 'nt': + _ = system('cls') + + # for mac and linux(here, os.name is 'posix') + else: + _ = system('clear') + + # print out some text + + +print('Hello CWIKIUS\n' * 10) + +# sleep for 2 seconds after printing output +sleep(2) + +# now call function we defined above +clear() diff --git a/tests/Variables.py b/tests/Variables.py index 5384a49..c5f830e 100644 --- a/tests/Variables.py +++ b/tests/Variables.py @@ -24,9 +24,11 @@ print(x) print(y) # 类型转换 -x = str(3) # x will be '3' -y = int(3) # y will be 3 -z = float(3) # z will be 3.0 +x1 = str(3) # x will be '3' +x2 = int(3) # y will be 3 +x3 = float(3) # z will be 3.0 +x4 = chr(31243) # z will be 3.0 +x5 = ord('程') # z will be 3.0 # 获得类型 print("==================")