# MyPython **Repository Path**: weixin.com/MyPython ## Basic Information - **Project Name**: MyPython - **Description**: python自学项目 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-02-08 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # MyPython python自学项目 # 【*】拆分符 ``` first,*rest, last =[1,2,3,4,5] print(rest) , 会自动把元组拆分成三分,带有*是多个元素 ``` # 【*】元组 ``` def print_everything(*args):   for count, thing in enumerate(args):     print '{0}.{1}'.format(count,thing) print_everything('apple','banana','cabbage')  #参数传入元组 ``` # 【**】power函数 ``` # 2的4次方 2**4 = 36 ``` # 【**】代表参数是字典 ``` # 代表的是参数是字典类型 def table_things(**kwargs):   for name, value in kwargs.items(): #字典     print '{0} = {1}'.format(name, value) table_things(apple = 'fruit',cabbage = 'vegetable') ``` # 同时使用\*和\**时,必须\*args参数列要在\**kwargs前