美文网首页
2020-05-28

2020-05-28

作者: 价值投机168 | 来源:发表于2020-05-28 15:24 被阅读0次

    1.传递任意参数给函数:


    image.png
    image.png

    2.传任意命名实参:


    image.png

    3.导入函数:


    image.png

    好处是:使用函数时,不用加模块名了
    可以使用as指定别名:
    from hello import helloFunc as hf
    上面是函数指定别名。
    也可:import hello as h
    这样,使用模块名的时候,使用h就可以了。

    4.打开文件,最好使用with语句,好处多多:

    image.png

    5.写入文件:


    image.png

    相关文章

      网友评论

          本文标题:2020-05-28

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