2020年2月26日

BeautifulSoup

摘要: BeautifulSoup解析器 解析器 使用方法 条件 bs4的HTML解析器 BeautifulSoup(mk,'html.parser') 安装bs库 lxml的HTML解析器 BeautifulSoup(mk,'lxml') pip install lxml lxml的xml解析器 Beau 阅读全文

posted @ 2020-02-26 00:23 winecork 阅读(201) 评论(0) 推荐(0) 编辑

2020年2月25日

requests模块学习

摘要: import requests url = 'https://item.jd.com/2967929.html' try: r = requests.get(url) r.raise_for_status() r.encoding = r.apparent_encoding print(r.text 阅读全文

posted @ 2020-02-25 04:08 winecork 阅读(162) 评论(0) 推荐(0) 编辑

2020年2月24日

正则表达式 运用

摘要: 从剪贴板中查找美国电话号码和电子邮件,并在屏幕打印。 import re import pyperclip #为电话创建正则表达式 phoneRegex = re.compile(r'''( (\d{3}|\(\d{3}\))? #区号 (\s|-|\.)? #分隔符 (\d{3}) #前三位 (\ 阅读全文

posted @ 2020-02-24 01:16 winecork 阅读(136) 评论(0) 推荐(0) 编辑

2020年1月29日

修改类的属性值

摘要: #直接修改属性的值# -*- coding:utf-8 -*- class Car(): def __init__(self,make,model,year): self.make = make self.model = model self.year = year self.odometer_re 阅读全文

posted @ 2020-01-29 00:17 winecork 阅读(385) 评论(0) 推荐(0) 编辑

2019年12月2日

值传递和引用传递

摘要: 根据实际参数的类型不同,可以将实际参数的值传递给形式参数,或将实际参数的引用传递给形式参数。 其中,当实际参数为不可变对象时,进行的时值传递;当实际参数为可变对象时,进行的时引用传递。 值传递和引用传递区别: 值传递后,改变形式参数的值,实际参数的值不变; 引用传递后,改变行是参数的值,实际参数的值 阅读全文

posted @ 2019-12-02 23:15 winecork 阅读(141) 评论(0) 推荐(0) 编辑

2019年12月1日

python正则表达式

摘要: 常用元字符 代码 说明 . 匹配除换行外的任意字符 \w 匹配字母、数字、下划线、汉字 \s 匹配任意的空白符 \d 匹配数字 \b 匹配单词的开始或结束 ^ 匹配字符串的开始 $ 匹配字符串的结束 常用限定符 限定符 说明 举例 ? 匹配前面的字符0次或1次 colou?r,可以匹配colour和 阅读全文

posted @ 2019-12-01 23:34 winecork 阅读(149) 评论(0) 推荐(0) 编辑

2019年11月2日

pyperclip模块

摘要: 安装pyperclip模块 pip install pyperclip 导入pyperclip模块后,复制文本“hello world”,打印现在剪切板上的内容“hello world” 阅读全文

posted @ 2019-11-02 16:48 winecork 阅读(202) 评论(0) 推荐(0) 编辑

2019年11月1日

python画国旗

摘要: import turtle def draw_rectangle(start_x,start_y,rec_x,rec_y): turtle.goto(start_x,start_y) turtle.color('red') turtle.fillcolor('red') turtle.begin_f 阅读全文

posted @ 2019-11-01 11:27 winecork 阅读(1044) 评论(0) 推荐(0) 编辑

2019年10月29日

linux6.5禁用telnet

摘要: # more /etc/redhat-releaseRed Hat Enterprise Linux Server release 6.5 (Santiago) 使用SSH协议进行远程维护,禁用telnetvi /etc/xinetd.d/telnetdisable=no重启xinetd进程serv 阅读全文

posted @ 2019-10-29 22:00 winecork 阅读(1450) 评论(0) 推荐(0) 编辑

限制用户su到root

摘要: eg:指定testuser用户可以切换到root用户 1.root操作,修改指定用户testuser附加组wheel # usermod -G wheel testuser 2.去掉su文件如下行的“#” # vi /etc/pam.d/su 3.文件login.defs末行添加“SU_WHEEL_ 阅读全文

posted @ 2019-10-29 16:06 winecork 阅读(515) 评论(0) 推荐(0) 编辑

导航