美文网首页
Map的用法

Map的用法

作者: 哦小小树 | 来源:发表于2022-08-27 10:35 被阅读0次
    关系映射
    # map两个参数,一个为函数,另一个为可迭代对象
    map(lambda x:x + 1, iterable)
    

    map数组直接解包

    a = [1,2,3,4,5]
    b = [*map(lambda x:x*3, a)]
    
    b # [3, 6, 9, 12, 15]
    

    * / **解压参数列表

    https://docs.python.org/3/tutorial/controlflow.html#unpacking-argument-lists

    http://wulc.me/2016/09/01/python%20%E4%B8%AD%E6%98%9F%E5%8F%B7%E5%8F%82%E6%95%B0%E4%BC%A0%E9%80%92/

    https://blog.csdn.net/DawnRanger/article/details/78028171


    * map用法

    相关文章

      网友评论

          本文标题:Map的用法

          本文链接:https://www.haomeiwen.com/subject/vrtoihtx.html