-
python
-
python数组数据的查 (in / not in)name = ["A","B","C"]
na= input("输入查找的对象:")
if na in name:
print("对象存在")
else:
print("不存在")
-
python
-
python for循环语句for i in range(3):
print(i)
for a in range(1,5,1):
print(a)
a = ['aa','bb','cc']
for i in range(len(a)):
print(i,a[i])
-
python
-
python 反斜杠与直接显示原始字符串print("nihao\nhaode")
print(r"nihao\nhaode")
-
python
-
python 生成随机数 import random
a = random.randint(1,7)
print(a)
-
python
-
python input输出password=(input("你的密码是:"))
print("你的密码是:",password)
-
python
-
python 切片a = "wuhan"print(a[0:3:1]) #起始位置:结束位置:跨境值 0下标开始