-
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数据的删除 (del,pop,remove)name = ["A","B","C"]
del name[1] #删除指定下标的对象
name.pop() #删除数组组后的一位
name.remove("B") #删除指定的对象,但是执行一次后失效
print(name)
-
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下标开始