推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
daijinming
V2EX  ›  Python

Python 新手求教 参数 **config 怎么解释

  •  1
     
  •   daijinming · Mar 5, 2019 · 3127 views
    This topic created in 2764 days ago, the information mentioned may be changed or developed.

    config = {} conn = mysql.connector.connect(**config)

    **config 怎么解释,是类似 C++中的指针吗

    完整代码地址

    9 replies  •  2019-03-07 10:12:54 +08:00
    myyou
        1
    myyou  
       Mar 5, 2019
    不是,是字典数据解包
    piqizhu
        2
    piqizhu  
       Mar 5, 2019
    不是, 在 python 中,它的名词叫 关键字参数 ,具体你搜索一下
    poplar50
        3
    poplar50  
       Mar 5, 2019 via Android
    字典参数,用以接收函数未定义的关键字参数
    daijinming
        4
    daijinming  
    OP
       Mar 5, 2019
    @myyou @piqizhu @poplar50 感谢,学习啦
    kiddingU
        5
    kiddingU  
       Mar 5, 2019
    字典参数,和 golang ... 类似把
    ljpCN
        6
    ljpCN  
       Mar 5, 2019 via Android
    类似 js 解构赋值
    CriseLYJ
        7
    CriseLYJ  
       Mar 5, 2019
    **有两种作用,一是打包,二是拆包,以字典的形式接收参数!
    dswill
        8
    dswill  
       Mar 6, 2019
    学习了。
    julyclyde
        9
    julyclyde  
       Mar 7, 2019
    就是一个 dict
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5375 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 02:22 · PVG 10:22 · LAX 19:22 · JFK 22:22
    ♥ Do have faith in what you're doing.