【Python学习记录】2021年8月24日
作者:互联网
作业:
1.list_data = ["apple", "watermelon", "orange", "banana", "peach", "blueberry", ]
# list_data.sort(key=lambda x: x[1])
#按第二个字符去排序,如果第二个字符相同,按照最后一个字符
2.定义一个函数,参数列表为:arg1, arg2=None, /, * ,arg3=4, arg4=5
请调用的时候传参
list_data = ["apple", "watermelon", "orange", "banana", "peach", "blueberry", ]
list_data.sort(key=lambda x: (x[1], x[-1]))
print(list_data)
print(80 * "★")
def args_test(arg1, /,*,arg3=4,arg2=None, arg4=5):
print(arg1, arg2, arg3,arg4)
args_test(1,arg4=100,arg3=200)
标签:24,Python,arg4,arg2,arg3,list,2021,arg1,data 来源: https://blog.csdn.net/qq_53372780/article/details/119897418