Code Monkey home page Code Monkey logo

Comments (4)

mayingping-Bella avatar mayingping-Bella commented on September 16, 2024

if __name=='main':

如果这个模块本身不被其他模块调用,而是自己运行的,有没有if __name__=='__main__',执行效果应该都是一样的,这时__name__的值就等于'__main__';

如果这个模块有被其他模块调用,就需要if __name__=='__main__'告诉调用这个模块的模块,if __name__=='__main__'中的代码在调用时不要被执行哦,因为这个时候__name__等于的是模块名并不等于__main__,执行if __name__=='__main__'之外的代码就可以啦。

from fresh-qa.

mayingping-Bella avatar mayingping-Bella commented on September 16, 2024

*args和**kwargs是什么意思

*args代表任何多个无名参数,返回的是 元组();
**kwargs表示关键字参数,所有传入的key=value,返回字典{};

from fresh-qa.

mayingping-Bella avatar mayingping-Bella commented on September 16, 2024

super().init()
super().init()继承父类的__init__()方法

from fresh-qa.

mayingping-Bella avatar mayingping-Bella commented on September 16, 2024

strip()用于移除字符串头尾指定的字符
upper() 方法将字符串中的小写字母转为大写字母

from fresh-qa.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.