try: a = 1/0 except Exception as e: print(e) else: print('else') finally...
# 只读 fo = open('test.txt') content = fo.read() fo.flush() # 提交...
import copy a = [1, 2, 3] # 浅拷贝,内存地址不变 b = a a[0] = 8 print(i...
简单的python的爬虫实现,仅仅作为练习代码使用。import re import urllib.request import sys,os # 获取网页html def ge...
import re # 查找abc print(re.findall('abc', 'xxxxabcxxxabcxxxx')) #['abc',...
新建“my_model.py”文件:from __future__ ipmort division def show(): return '说易事'; print(_...
l = [1, 5, -10, 0, 30, 22] # 绝对值 print(abs(-5)) #5 #最大值 print(max(l...
# python是没有专门的switch关键字的,但是有灵活替代方案。 # 方式一: a = 2 b = 3 result = { '+...
# lambad表达式,至于用途就仁者见仁智者见智 g = lambda x,y:x+y print(g(2,3)) # 5...
#python的函数定义及调用 # 无参函数 def show(): print('hello') show() # 调用 # 有参函数 def...
阅读: 20110
阅读: 17245 评论:1
阅读: 16416
阅读: 16409
阅读: 15790
阅读: 15563
扫扫关注微信