python入这门基本语句与re.pptVIP

  • 2
  • 0
  • 约1.65千字
  • 约 12页
  • 2018-12-31 发布于福建
  • 举报
python入这门基本语句与re

Python入门 BSC CM Python入门 主要内容 print语句与赋值语句 print语句用于在屏幕上输出内容 例子1 a, b = 3, 4 a, b = b, a print “a=%d,b=%d” % (a,b) 例子2 a, b = 3.0, 4.0 print “b/a=.2f” % (b/a) if语句 例子 x = int(raw_input(Please enter an integer: )) if x 0: x = 0 print Negative changed to zero elif x == 0: print Zero elif x == 1: print Single else: print More for语句 语法: for item in items: 这种形式可读性好,使用方便 例子1 for item in list1: print item 例子2 for i in range(0,len(list1)): print list1[i] 其他语句 while, continue, break, return 和C语言中的用法一致 pass 空语句,类似C语言中的”;” import 引用一个包,类似java中的import del 清除

文档评论(0)

1亿VIP精品文档

相关文档