zoukankan      html  css  js  c++  java
  • python基础知识

    python初体验

     print and input

    print()是打印,input()是函数,该函数用来获取用户的输入

    python基础讲解

    python变量特性+命名规则

    1,变量名的长度不受限制,但其中的字符必须是字母,数字,或者下划线(_),而不能使用空格,连字符,标点符号,引号或其他字符

    2,变量名的第一个字符不能是数字,而必须是字母或者下划线

    3,python区分大小写

    4,不能将python关键字用作变量名

    注释方法

    1,#这是一个注释

    2,单引号

    3,双引号(多行注释可以用三个单引号或者三个双引号)

    python中“:”作用

    1,在函数定义语句、循环、条件、类定义等后面使用

    2,在切片中使用

    dir( )及和help( )

    dir()函数返回包含要查询对象的所有属性名称的列表

    dir()
    
    ['In',
     'Out',
     '_',
     '__',
     '___',
     '__builtin__',
     '__builtins__',
     '__doc__',
     '__loader__',
     '__name__',
     '__package__',
     '__spec__',
     '_dh',
     '_i',
     '_i1',
     '_ih',
     '_ii',
     '_iii',
     '_oh',
     'exit',
     'get_ipython',
     'quit']
    

      help()帮助文档

    help()
    
    
    Welcome to Python 3.7's help utility!
    
    If this is your first time using Python, you should definitely check out
    the tutorial on the Internet at https://docs.python.org/3.7/tutorial/.
    
    Enter the name of any module, keyword, or topic to get help on writing
    Python programs and using Python modules.  To quit this help utility and
    return to the interpreter, just type "quit".
    
    To get a list of available modules, keywords, symbols, or topics, type
    "modules", "keywords", "symbols", or "topics".  Each module also comes
    with a one-line summary of what it does; to list the modules whose name
    or summary contain a given string such as "spam", type "modules spam".
    
    
    
    
    
    
    help> 
    

     import使用 

    import函数语句用于引入模块、从模块中导入一个指定部分、把一个模块的全部内容导入 

     python数值基本知识

    python中数值类型,int,float,bool,e记法等

    int表示整型;
    float表示浮点型;
    bool是布尔类型,有ture跟false两个值;

    算数运算符

    包含了+ - * / % ** //

    逻辑运算

     成员运算符

    身份运算符

    运算符优先级

  • 相关阅读:
    游戏热更思路
    Shader实现新手指引挖空圆形和矩形
    C#利用栈实现字符串运算解析
    Unity UGUI和特效(含粒子系统和3D Object)之间层级问题
    Unity中的值传递与引用传递
    Unity3D中的线程与协程
    进程、线程、协程、CPU
    Photon Server与Unity3D客户端的交互
    Photon Server的Unity3D客户端配置
    Photon Server的服务器端配置
  • 原文地址:https://www.cnblogs.com/MsHibiscus/p/10634152.html
Copyright © 2011-2022 走看看