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

    1.查看内置函数

    >>> dir(__builtins__)

    2.查看内置函数帮助

    >>> help(input)

    help查看

    3.变量

    变量没有声明,直接使用。如: thacher="rex". 

    注意: 1>要有赋值。

    4.字符串

    转义字符

    原始字符串:r'c:program cs'

    5.比较运行符

    OperatorDescriptionExample
    == If the values of two operands are equal, then the condition becomes true. (a == b) is not true.
    != If values of two operands are not equal, then condition becomes true.
    <> If values of two operands are not equal, then condition becomes true. (a <> b) is true. This is similar to != operator.
    > If the value of left operand is greater than the value of right operand, then condition becomes true. (a > b) is not true.
    < If the value of left operand is less than the value of right operand, then condition becomes true. (a < b) is true.
    >= If the value of left operand is greater than or equal to the value of right operand, then condition becomes true. (a >= b) is not true.
    <= If the value of left operand is less than or equal to the value of right operand, then condition becomes true. (a <= b) is true.

    6. 不换行打印, 99表

    form __future__ import print_function
    
    def test():
        for i in range(1, 10):
            for j in range(1, i+1)
                print('%d * %d = %d  '%(i, j, i * j), end='') # end='' 表示不换行
            print('')
    
    test()

      

    http://www.tutorialspoint.com/python/ 

    以上操作在Python shell 中运行!

  • 相关阅读:
    常见排序算法总结(C语言版)
    “仿QQ局域网聊天软件”项目-常用编程技巧总结
    Java集合类之向量Vector
    Java集合类之LinkedList链表
    Java集合ArrayList的应用
    Java集合类之ArrayList
    Java二维数组
    二分查找
    快速排序法QuickSort
    插入排序InsertionSort
  • 原文地址:https://www.cnblogs.com/rexhu/p/5491848.html
Copyright © 2011-2022 走看看