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两个值;

    算数运算符

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

    逻辑运算

     成员运算符

    身份运算符

    运算符优先级

  • 相关阅读:
    电子海图开发一百篇第五十五篇-电子江图传输规范 数据模型
    天气可视化,海浪,温度图层的绘制,温度热力图的可视化
    全球潮汐数据API使用方法,潮汐数据查询
    海洋气象数据可视化,以流场的方式显示风场图,海洋气象API使用
    g++ 编译module失败
    编译gcc error-*** LIBRARY_PATH shouldn‘t contain the current directory when *** building gcc.
    windows两种自启动的区别
    windows多线程加锁
    windows server 2012不显示此电脑
    pthread_cond_wait
  • 原文地址:https://www.cnblogs.com/MsHibiscus/p/10634152.html
Copyright © 2011-2022 走看看