pythonav第八天作业

v=v[::-1]
print(v)
info = [
    {'k1':(1),'k2':{'k9':'oldboy','k10':'一天天'}},
    (11,22,33,44),
    {199,2,3,4,5},
    True,
    ['武沛齐','景女神',{'extra':("alex",'eric',[18,20])}]
]
print(info[0]["k1"])
print(info[0]["k2"]["k9"])
print(info[1][3])
print(info[0]["k2"]["k10"][1:3])
for i in info:
    print(i)
dict={"True":"真"}
info[4][2].update(dict)
print(info)
info[4][2]["extra"][2].append("69")
print(info)
v="k1|v1,k2|v2,k3|v3"
dic={}
dic_temp=[]
for i in v.split(","):
    dic_temp=i.split("|")
    dic[dic_temp[0]]=dic_temp[1]
print(dic_temp,dic)
content=input("请输入内容:")
result=1
content_list=content.split("*")
for i in range(len(content_list)):
    result*=int(content_list[i].strip())
print(result)
v1 = [1,2,3,4,5]
v2 = [v1,v1,v1]
v2[1][0] = 111
v2[2][0] = 222
print(v1)
print(v2)
info = ['你是','到底','是','不是','一个','魔鬼']
log=str(info[0::2]).replace(",","*")
print(log)

```python
cars = ['鲁A32444', '鲁B12333', '京B8989M', '黑C49678', '黑C46555', '沪B25041', '黑C34567']
dic={}
for i in range(len(cars)):
    dic[cars[i][0]]=0
for i in range(len(cars)):
    dic[cars[i][0]]+=1
print(dic)`f = open("data.txt",mode="r",encoding="utf-8")
info=[]
dic={}
a=1
f1=[line.strip()for line in f.readlines()]
for i in f1:
    if a:
        catagory=i.split(",")
        a=0
    else:
        content=i.split(",")
        for i in range(len(catagory)):
            dic[catagory[i]]=content[i]
            info.append(dic)
print(catagory,f1,info)`
for i in range(1,10):
    for j in range(1,i+1):
        print("%d*%d"%(i,j),end="")
    print("")

你可能感兴趣的:(python学习笔记)