一、输入/加密
#!/usr/bin/python
#coding:utf-8import getpass
name = raw_input('请输入用户名:')pwd = getpass.getpass('请输入密码:')if name == "alex" and pwd == "cmd": print "欢迎,alex!"else: print "用户名和密码错误"
二、enumrate
li
=
[
11
,
22
,
33
]
for
k,v
in
enumerate
(li,
1
):
print
(k,v)
三、 range和xrange
print
range
(
1
,
10
,
2
)
# 结果:[1, 3, 5, 7, 9]
print
range
(
30
,
0
,
-
2
)
# 结果:[30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2]