-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path01_basic.py
More file actions
78 lines (63 loc) · 1.24 KB
/
01_basic.py
File metadata and controls
78 lines (63 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python
#_*_coding:utf-8_*_
#__author:"Jack Li"
#date: %Y-%m-%d
# 001 变量,输出
'''name = "Jack"
print("hello word!","您好:",name,sep="")
# 002 输入
import getpass
# 将用户输入的内容赋值给 name 变量
pwd = getpass.getpass("请输入密码:")
# 打印输入的内容
print(pwd)
del pwd
age = int(input("输入int:"))
print("age:",age)
'''
print('name:%-10s age:%-10d height:%-5.2f' % ('Jack',26,1.890))
# step 003 集合
# 元组(不可变列表)
name_list = ['alex', 'seven', 'eric']
name_list = list(['alex', 'seven', 'eric'])
#字典(无序)
person = {"name": "mr.wu", 'age': 18}
person = dict({"name": "mr.wu", 'age': 18})
for i in person:
print(i,person[i]);
# step 004 if
'''
age = 20
if age > 20 :
print("大于20")
elif age > 30 :
print("大于30")
else:
print("其他")
'''
# step 004 for while break continue
'''
for i in name_list:
if i == 'seven':
print("找到seven")
break;
print(i)
count = 1
while True:
count+=1
if count==10:
continue;
elif count==20:
break;
else:
print("");
print("循环次数",count)
'''
# step 005 三元运算
choice = True==False
result = "ok" if choice else "No"
print(result)
# step 006 模块
import os,sys
#print(os.environ)
#print(sys.path)