python 基础

1.查看内置函数

>>> dir(__builtins__)

2.查看内置函数帮助

>>> help(input)

help查看

3.变量

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

注意: 1>要有赋值。

4.字符串

转义字符 \

原始字符串:r'c:\program\tcs'

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 中运行!

posted on 2016-05-14 07:37  rexhu  阅读(143)  评论(0编辑  收藏  举报

导航