随笔分类 - python
小程序
摘要:# git 工作总计 1 首先先克隆了git地址 master 分子 (这个做一次) 以后循环做的 2:git checkout -b dev 创建了临时开发的dev 分子 3:修改dev 分子的数据,add commit (代码开发中.....) 4:git push origin dev 提交了
阅读全文
摘要:pip使用过程中的痛苦,大家相必都已经知道了,目前豆瓣提供了国内的pypi源,源包相对会略有延迟,但不影响基本使用。 pip install some-package -i https://pypi.douban.com/simple/ PyPI(Python Package Index)是python官方的第三方库的仓库,所有人都可以下载第三方库或上传自己开发的库到PyPI。PyPI推荐使...
阅读全文
摘要:data = set() data.clear() data.add('qq1') data.add('qq2') data.add('qq3') data.add('qq4') data.add('qq1') data.add('qq2') data.add('qq3') data.add('qq4') add = 'qq1' print(type(data)) if add in dat...
阅读全文
摘要:# 文件下载方法 from urllib.request import urlretrieve import requests # 第一 urlimage = 'https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz' urlretrieve(urlimage, "logo.tar.xz") #第二 ir = request...
阅读全文
摘要:html = requests.get('http://s.114chn.com/s-o65ivdsi', headers=headers,proxies = proxies)# 第一种方法# print(html.encoding) # ISO-8859-1# html.encoding="utf
阅读全文
摘要:ubuntu,装完PYTHON3 pip3 install 报错CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1Traceback (most recent call last): 这应该是pyt
阅读全文
摘要:http://idea.lanyus.com/ 复制通用注册码,粘贴在注册界面的Activation code的输入框中,点击 ok。 EB101IWSWD-eyJsaWNlbnNlSWQiOiJFQjEwMUlXU1dEIiwibGljZW5zZWVOYW1lIjoibGFuIHl1IiwiYXN
阅读全文
摘要:nohup python -m SimpleHTTPServer 8000 > myout.file 2>&1 & #!/bin/bashkill `ps -ef | grep http.server| grep -v grep|awk '{print $2}'`cd /home/liuyoushu
阅读全文
摘要:import smtplib from email.mime.text import MIMEText from email.header import Header # 发送邮箱服务器 smtpserver = 'smtp.sina.com' # 发送邮箱用户/密码 user = 'username@sina.com' password = '123456' # 发送邮箱 sender = ...
阅读全文
摘要:可参照:http://www.voidcn.com/blog/Vindra/article/p-4917667.html 一、get请求 curl "http://www.baidu.com" 如果这里的URL指向的是一个文件或者一幅图都可以直接下载到本地 curl -i "http://www.b
阅读全文
摘要:yum -y install mysql-devel libxml2 libxml2-dev libxslt* zlib gcc openssl yum install gcc libffi-devel python-devel openssl-devel pip install MySQL-pyt
阅读全文
摘要:#查看电脑的版本 C:\Users\lys>pip -V pip 8.1.1 from e:\python\python3.5\lib\site-packages (python 3.5) #安装 C:\Users\lys>pip install virtualenv #创建 C:\Users\lys>virtualenv testvir #进入 C:\Users\lys>cd testvir ...
阅读全文
摘要:#!/usr/bin/env python # _*_ coding:utf-8 _*_ # Author:Liuyoushui # Time = 2017/7/18 10:33 print ('\n'.join([' '.join(['%s*%s=%2s' % (y,x,x*y) for y in range(1,x+1)]) for x in range(1,10)])) print([...
阅读全文
摘要:1 #!/usr/bin/env python 2 #_*_ coding:utf-8 _*_ 3 #输出代码的头部信息的三种方法 4 5 str1 = 'version' 6 num = 1.0 7 time = '2016-9-25' 8 auther = 'lys' 9 qq = '1234567' 10 addr = '北京天通苑301' 11 12 #%10s是前...
阅读全文
摘要:递归的实现条件 1:函数内自己调用自己,2:有明确的退出条件,要不会死循环,报错
阅读全文
摘要:1 #!/usr/bin/env python 2 #encoding: utf-8 3 import time 4 def consumer(name): 5 print ('%s 来吃包子了。。。' % (name)) 6 while True: 7 baizi = yield #执行到这会暂停,直到调用next的方法,然后在从这里执行 8 ...
阅读全文
摘要:1 #!/usr/bin/env python 2 #encoding: utf-8 3 def start_info(): 4 print ('电视剧开头曲.......') 5 print ('开始唱歌.......') 6 def end_info(): 7 print ('电视剧结束曲.......') 8 9 def filter(start...
阅读全文
摘要:passwd.txt 文件按格式 用户名:密码 用户名2:密码 clok.txt 文件格式 用户名1 用户名2
阅读全文
摘要:1 #!/usr/bin/env python 2 #encoding: utf-8 3 number = 88 4 5 for i in range(1,6): 6 num = int(input('gusee number game(5 机会):')) 7 print('第 %s 机会' % (i)) 8 if num >number: 9 ...
阅读全文