编写变量相关的内容

This commit is contained in:
YuCheng Hu 2021-03-07 23:49:49 -05:00
parent ee2e967d6c
commit 6201479731
No known key found for this signature in database
GPG Key ID: 1E5CBEF8B550FB7D
2 changed files with 34 additions and 3 deletions

29
tests/CleanScreen.py Normal file
View File

@ -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()

View File

@ -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("==================")