摘要:
result: example2: result : 阅读全文
摘要:
while 语句: for 语句: 阅读全文
摘要:
>>> age = 10 >>> assert 0 ", line 1, in AssertionError >>> assert 0 < age < 11 阅读全文
摘要:
x == y x < y x <= y x >= y x != y x is y x is not y x in y x not in y 阅读全文
摘要:
int(x [,base ]) 将x转换为一个整数 long(x [,base ]) 将x转换为一个长整数 float(x ) 将x转换到一个浮点数 complex(real [,imag ]) 创建一个复数 str(x ) 将对象 x 转换为字符串 repr(x ) 将对象 x 转换为表达式字符串 阅读全文
摘要:
name = input('what is your name?')if name.endswith('zd'): print("hello panzidong") name = input('what is your name?')if name.endswith('zd'): print("he 阅读全文
摘要:
序列解包: >>> x,y,z = 1, 2, 3>>> print(x, y, z)1 2 3 >>> a,b, *reset = [1,2,3,4]>>> print(a,b,reset)1 2 [3, 4] 链式赋值: x = y = function 增量赋值: >>> x = 2>>> x 阅读全文
摘要:
>>> print("aaaa","bbbb")aaaa bbbb>>> print(1, 2, 3)1 2 3 为模块提供别名: >>> import math as foobar>>> foobar.sqrt(4)2.0 为函数提供别名: >>> from math import sqrt as 阅读全文
摘要:
字典的创建: >>> phonebook = { 'Alice': '2341', 'Beth': '9102', 'Cecil': '3258'} dict函数: >>> items = [('name','pan'),('age', 32)]>>> d = dict(items)>>> d{'n 阅读全文
摘要:
key point: 字符串都是不可改变的 打印: >>> values('world', 'hot')>>> format'hello, %s. %s enough for ya'>>> print(format % values)hello, world. hot enough for ya > 阅读全文