手头没纸笔网上随便记点python知识点

#字典 dict { }
#key-value pair
哈希算法支持
字典中的内容并不是按照输入的先后顺序存储,而是按照哈希算法计算得到的值存储。并且字典不可以用下标来访问
字典中的值可以是任意数据类型,键必须是可哈希类型(列表list、字典dict不是,int\str\float\tuple是)
可修改数据类型

#字符串格式化

sText="Marry have {} lambs, they are {n1}, {n2} and {}".format(3, 'cot', n2='happy', n1='nauty')

#函数与抽象
形参
实参
关键字参数
任意数量参数:

def myprint(title,*contents):
	print(title,":")
	for i in contents:
		print("\t",x)

myprint("Read-only data types","int","float","str","tuple","bytes")

参数分配

def myprint(title,name,gender,age,salary)
	......

dora=("dora's information is",'dora','female',26,3200)
myprint(*dora)

dora2=dict("dora's information is",'dora','female',26,3200)
myprint("dora's information is:",**dora2)

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