文章分类 -  Python

摘要:https://blog.csdn.net/AinUser/article/details/80206114 https://www.cnblogs.com/zrbfree/p/6419043.html 阅读全文
posted @ 2019-01-18 11:13 桃源仙居 阅读(57) 评论(0) 推荐(0)
摘要:# -*- coding: utf-8 -*- """使用 Python 在内存中生成 zip 文件""" import os import zipfile import StringIO import requests class InMemoryZip(object): def __init__(self): # Create the in-memory ... 阅读全文
posted @ 2018-12-27 19:28 桃源仙居 阅读(99) 评论(0) 推荐(0)
摘要:sudo vim /home/apache/conf/extra/httpd-vhosts.conf SetHandler uwsgi-handler uWSGISocket 127.0.0.1:18007 Alias /wechat_os/statics /logs/makexu_workspace/website/platform/wechat_os/statics... 阅读全文
posted @ 2018-12-27 14:37 桃源仙居 阅读(108) 评论(0) 推荐(0)
摘要:如果用urllib.quote_plus(u'基础')会抛出KeyError异常。: 解决方法 阅读全文
posted @ 2018-12-25 11:29 桃源仙居 阅读(1441) 评论(0) 推荐(0)
摘要:1.获取代理 # -*- coding:utf-8 -*- import HTMLParser import requests import json import re class MyParser(HTMLParser.HTMLParser): def __init__(self): HTMLParser.HTMLParser.__init__(self) ... 阅读全文
posted @ 2018-12-10 16:13 桃源仙居 阅读(160) 评论(0) 推荐(0)
摘要:x='\xE5\xB8\xAE' bb=str(x) print bb.decode('string_escape') 阅读全文
posted @ 2018-11-07 19:59 桃源仙居 阅读(476) 评论(0) 推荐(0)
摘要:返回的week是int类型,0-6分别对应周一到周日,如果是周六或者周日就取周五的时间 阅读全文
posted @ 2018-09-06 16:30 桃源仙居 阅读(66) 评论(0) 推荐(0)
摘要:1.获取指定内容 # 文本 <Server ServerId='0001' xxxx /> <Server ServerId='0002' xxxx /> <Server ServerId='0003' xxxx /> <Server ServerId='0004' xxxx /> <Server 阅读全文
posted @ 2018-08-22 16:41 桃源仙居 阅读(242) 评论(0) 推荐(0)
摘要:#!/usr/bin/env python # -*- coding:utf-8 -*- # 系统入口,监测chat日志文件变化 """Code By , 引入多进程处理""" from notify_base import NotifyBase from global_common import parse_mgame_log import os from mylog import log... 阅读全文
posted @ 2018-08-15 16:09 桃源仙居 阅读(158) 评论(0) 推荐(0)
摘要:转自:文章地址 以前一直头疼各种特殊的排序怎么实现,比如dict的value排序,list嵌套dict排序,当时只能想到多次循环遍历;但自从学习了lambda,简直没有什么排序不能解决了... 考虑到tuple在排序时和list区别并不大,所以不考虑tuple;而dict的key采用hash实现,仅 阅读全文
posted @ 2018-07-31 13:49 桃源仙居 阅读(148) 评论(0) 推荐(0)
摘要:curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py 阅读全文
posted @ 2018-07-26 09:43 桃源仙居 阅读(49) 评论(0) 推荐(0)
摘要:#!/usr/bin/env python # -*- coding:utf-8 -*- import urllib import urllib2 import re import os def proxy_ip(): os.environ['http_proxy'] = '' # 访问网址 url = 'http://www.whatismyip.com.tw/'... 阅读全文
posted @ 2018-07-09 09:35 桃源仙居 阅读(357) 评论(0) 推荐(0)
摘要:dc_array = {} list_array = ['1', '2', '3', '2', '4', '2', '3', '5'] set_array = set(list_array) for item in set_array: dc_array.update({item: list_array.count(item)}) print dc_array ------ {'1':... 阅读全文
posted @ 2018-07-03 15:11 桃源仙居 阅读(800) 评论(0) 推荐(0)
摘要:一、安装virtualenv pip install virtualenv 二、创建python虚拟环境:virtualenv [虚拟环境名称] cd /home/makexu/env virtualenv fasttext # 在所在文件夹生成一个与虚拟环境同名的文件夹 三、启动虚拟环境 source /home/makexu/env/fasttext/bin/activate ... 阅读全文
posted @ 2018-05-28 10:59 桃源仙居 阅读(271) 评论(0) 推荐(0)
摘要:#!/usr/bin/env python # -*- coding: utf-8 -*- """ # @Time : 2018/5/18 10:48 # @Author : N7053 # @File : test.py # @Software: PyCharm # @Desc : """ import re import json def match_case(wo... 阅读全文
posted @ 2018-05-18 14:10 桃源仙居 阅读(314) 评论(0) 推荐(0)
摘要:curdir=os.path.dirname(os.path.dirname(os.path.abspath(__file__))) curdir=os.path.dirname(os.path.abspath(__file__)) curdir=os.path.join(curdir, 'test 阅读全文
posted @ 2018-03-09 17:17 桃源仙居 阅读(49) 评论(0) 推荐(0)
摘要:另外的 阅读全文
posted @ 2017-12-06 22:49 桃源仙居 阅读(113) 评论(0) 推荐(0)
摘要:# 简单的dict lst = [('d', 2), ('a', 4), ('b', 3), ('c', 2)] # 按照value排序 lst.sort(key=lambda k: k[1]) print lst # 按照key排序 lst.sort(key=lambda k: k[0]) print lst # 先按value排序再按key排序 lst.sort(key=lambda ... 阅读全文
posted @ 2017-10-13 16:09 桃源仙居 阅读(173) 评论(0) 推荐(0)
摘要:# 东八区时间处理 阅读全文
posted @ 2017-10-10 14:14 桃源仙居 阅读(213) 评论(0) 推荐(0)
摘要:1.基本的多线程 2.可以获取子线程数据的多线程 阅读全文
posted @ 2017-09-27 21:02 桃源仙居 阅读(70) 评论(0) 推荐(0)