(1)计算裴波那契数列: fbis=[0,1] num=int(input("please input the number")) for i in range(num-2): fbis.append(fbis[-2]+fbis[-1]) print(fbis) 6.3 创建函数 callable():函数可以确定函数是否可以被调用 最简单的例子: def hello(name): return "hello"+name+"are you OK?"…
simple_markup.py import sys, re from util import * print('<html><head><title>...</title><body>') title = True for block in blocks(sys.stdin): block = re.sub(r'\*(.+?)\*',r'<em>\1</em>',block) if title: print('<…
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. #3.1基本字符串操作 >>> website = 'http://www.python.org' >>> websi…