- 博客(8)
- 收藏
- 关注
原创 Python--多线程基础
Python–多线程基础1.利用多线程和多进程实现基础的同时下载文件from random import randintfrom time import time,sleepfrom multiprocessing import Process #多进程from os import getpidfrom threading import Thread #多线程def download_task(filename): print('启动下载进程,进程号【%d】' % getpid
2021-01-13 16:50:04 187
原创 Python--正则表达式
Python–正则表达式https://itbook.xuxinkai.cn/read/Python-100-Days/Day01-15-12.%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%92%8C%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F.md例子:匹配电话号码import redef main(): # 创建正则表达式对象 使用了前瞻和回顾来保证手机号前后不应该出现数字 pattern = re.compile(r
2021-01-13 14:16:23 154
原创 Python--继承和多态
Python–继承和多态将对象的共同属性进行归类,不用点进行区分,重点在于继承共同父类的函数处理名称和年龄,然后各自处理自己的职位和动作。class Person(object): def __init__(self,name,age): self.__name = name self.__age = age @property def name(self): return self.__name @property
2021-01-11 15:09:09 286 1
原创 Python--面向对象中装饰器的使用
Python–面向对象中装饰器的使用class Person(object): def __init__(self,name,age): self.__name = name self.__age = age @property def name(self): return self.__name @property def age(self): return self.__age @age.s
2021-01-11 14:22:50 224
原创 Python——txt转化表格
Python——txt转化表格import xlwtimport osimport sysdef txt_xls(filename, xlsname): try: f = open(filename) xls = xlwt.Workbook() sheet = xls.add_sheet('sheet', cell_overwrite_ok=True)# sheet = xls.add_sheet('sheet')
2021-01-08 16:50:23 673
原创 Python——格式化数据文件
Python——格式化数据文件alllist=[]def readfile(): with open('/home/zhangxuyang/shell/date1.txt') as lines: #一次性读入txt文件,并把内容放在变量lines中 array=lines.readlines() #返回的是一个列表,该列表每一个元素是txt文件的每一行 for i in array: #遍历array中的每个元素 i=i.strip('
2021-01-08 16:47:57 185
原创 Python——request访问接口
Python——request访问接口# coding=gbkimport requestsimport jsonimport reimport codecsdef uniform_query(): seal = [] patload={} url = "你的接口,亲" headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (K
2021-01-08 16:46:55 557
原创 python——模拟服务器发送邮件
python发送邮件脚本记录import smtplibfrom email.mime.text import MIMETextfrom email.mime.multipart import MIMEMultipartdef Mailer(to_list, th1=None, Subject=None, unipath=None): mail_host = 'smtp.qq.com' # 邮箱服务器 mail_user = '1479247514@qq.com' # 发件人邮箱
2021-01-08 16:44:34 683
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人