<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[单远涛]]></title><description><![CDATA[程序员的日常]]></description><link>https://blog.youkuaiyun.com/hello_syt_2018</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; hello_syt_2018]]></copyright><item><title><![CDATA[python装饰器]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/102790070</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/102790070</guid><author>hello_syt_2018</author><pubDate>Mon, 28 Oct 2019 23:20:39 +0800</pubDate><description><![CDATA[定义：在代码运行期间动态增加功能的方式，称之为“装饰器”（Decorator），比如在函数执行前后打印日志
装饰器调用分析：

不带参数装饰器

def log(fun):
    def wrapper(*args, **kwargs):
        print('001', fun.__name__)
        return fun(*args, **kwargs)

    ret...]]></description><category></category></item><item><title><![CDATA[pandas02 -- 处理丢失的数据]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80752436</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80752436</guid><author>hello_syt_2018</author><pubDate>Wed, 20 Jun 2018 20:47:06 +0800</pubDate><description><![CDATA[处理丢失的数据



在mysql中空值null就是丢失的数据，在pandas中丢失的数据是NaN，在numpy中为np.nan、None, 空值对程序的计算结果是没有影响的但是降低了程序的执行效率，因此应该尽量避免空值



pandas中对于空值的操作

 1. isnull()
 2. notnull()
 3. dropna()  #过滤空值
 4. fillna()      #填充空值...]]></description><category></category></item><item><title><![CDATA[pandas01 - Series和DataFrame]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80751930</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80751930</guid><author>hello_syt_2018</author><pubDate>Wed, 20 Jun 2018 19:59:03 +0800</pubDate><description><![CDATA[数据分析三剑客（三个模块）:numpy、pandas、matplotlib；前两个属于数据分析，展示数据，后一个用于画图;

pandas中有两个常用的类：Series、DataFrame;


Series对象是类似一维数组的，由下面两个部分组成：

values：一组数据（ndarray类型）
index：相关的数据索引标签

DataFrame是一个【表格型】的数据结构，可以看做是【由Ser...]]></description><category></category></item><item><title><![CDATA[Numpy、matplotlib]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80749079</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80749079</guid><author>hello_syt_2018</author><pubDate>Wed, 20 Jun 2018 17:25:38 +0800</pubDate><description><![CDATA[简介

numpy - numeric python, 即数字化的python；python 支持的数值类型有整型、浮点型、布尔型、和复数型；numpy支持更多的数值类型：

    1. `bool`：布尔类型，1 个字节，值为 True 或 False。

    2. `int`：整数类型，通常为 int64 或 int32 。

    3. `intc`：与 C 里的 int 相同，通常...]]></description><category></category></item><item><title><![CDATA[git 本地仓库]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80685252</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80685252</guid><author>hello_syt_2018</author><pubDate>Wed, 13 Jun 2018 21:13:26 +0800</pubDate><description><![CDATA[git

git是当前最流行的版本控制软件

在本地安装git

检查是否安装git : git –version

1.建立仓库

在本地建立一个文件夹，里面放上要放在git仓库中管理的文件，在命令行提示符中，进入到该文件夹下，执行命令git init 这是把该普通的文件夹初始化成git仓库，通过输出可以查看初始画的是一个空仓库，仓库是程序中被git主动跟踪的一组文件，这时你查看下该文件夹，会发...]]></description><category></category></item><item><title><![CDATA[爬虫 - 数据存储]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80621302</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80621302</guid><author>hello_syt_2018</author><pubDate>Sat, 09 Jun 2018 13:00:53 +0800</pubDate><description><![CDATA[



今天我们可以通过第三方平台（如：Google,Facebook等）可以很容易的访问和抓取数据。用户的个人信息，社交网络，地理位置，用户生成的数据和用户操作日志已经成倍的增加。我们如果要对这些用户数据进行挖掘，那SQL数据库已经不适合这些应用了, NoSQL数据库的发展也却能很好的处理这些大的数据。 
使用NoSQL数据库 
NoSQL - not only SQL 非关系型数据存储

使用...]]></description><category></category></item><item><title><![CDATA[scrapy 框架新建一个 爬虫项目详细步骤]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80589766</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80589766</guid><author>hello_syt_2018</author><pubDate>Sat, 09 Jun 2018 11:23:40 +0800</pubDate><description><![CDATA[利用scrapy框架新建一个爬虫项目，完整步骤如下：

mkdir douban
cd douban
创建虚拟环境命名为venv， 代替了virtualenv --no-site-pages +virtual_name
python -m venv venv   
dir  看目录
cd venv  
cd Scripts
activate   启动虚拟环境
cd  ../../   回到我的用户...]]></description><category></category></item><item><title><![CDATA[爬虫 - 数据采集和解析]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80620671</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80620671</guid><author>hello_syt_2018</author><pubDate>Fri, 08 Jun 2018 11:22:23 +0800</pubDate><description><![CDATA[爬虫数据采集和解析





数据采集

1. 下载数据的方式 -  urllib、requests、aiohttp


urllib 用法

from urllib.request import urlopen
html = urlopen('http://sports.sohu.com/nba_a.shtml').read()
requests用法

import requests
resp ...]]></description><category></category></item><item><title><![CDATA[正则表达式]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80609748</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80609748</guid><author>hello_syt_2018</author><pubDate>Thu, 07 Jun 2018 15:12:56 +0800</pubDate><description><![CDATA[简介


正则表达式一种专门用来搜索字符串的方式，通过构建不同的模式，从而在字符串中匹配出自己想要的字符
正则表达式可以在很多种语言中使用，这些语言也专门为正则表达式的使用，提供了不同的语言支持，具体使用详情，请在菜鸟教程中查看




写正则表达式的时候，总是感觉无从下手，不知道什么时候加个正斜杠什么时候加个反斜杠，或者加个r 是干什么的，我相信看完下面你就肯定清楚了


正则表达式中的字母和数...]]></description><category></category></item><item><title><![CDATA[多进程爬取手机搜狐网所有页面]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80597205</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80597205</guid><author>hello_syt_2018</author><pubDate>Wed, 06 Jun 2018 16:38:35 +0800</pubDate><description><![CDATA[在进行爬取操作之前介绍下threading.lock类和concurrent.futures模块以及分布式进程:


threading.local类

使用线程时最不愿意遇到的情况就是多个线程竞争资源，在这种情况下为了保证资源状态的正确性，我们可能需要对资源进行加锁保护的处理，这一方面会导致程序失去并发性，另外如果多个线程竞争多个资源时，还有可能因为加锁方式的不当导致死锁。要解决多个线程竞争资源...]]></description><category></category></item><item><title><![CDATA[进程和线程]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80595254</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80595254</guid><author>hello_syt_2018</author><pubDate>Wed, 06 Jun 2018 15:06:10 +0800</pubDate><description><![CDATA[简介

今天我们使用的计算机早已进入多CPU和多核时代，而我们使用的操作系统都是支持“ 多任务的“，这使得我么可以同时运行多个程序，也可以将一个程序分解为若干个相对独立的子任务，让多个子任务并发执行，从而缩短程序的执行时间，同时也让用户获得更好的体验。因此当下不管用什么语言进行开发，实现让程序同时执行多个任务也就是常说的并发编程，应该是程序员必备的技能之一。实现多任务并发执行，python中提供了...]]></description><category></category></item><item><title><![CDATA[装饰器]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80590643</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80590643</guid><author>hello_syt_2018</author><pubDate>Wed, 06 Jun 2018 09:52:24 +0800</pubDate><description><![CDATA[示例01


类包装器

这是写爬虫时给爬虫定义的包装器，用来装饰爬虫爬取行为失败后，尝试的次数，装饰器中是可以传入参数的
class Retry(object):
    &quot;&quot;&quot;
    包装器
    &quot;&quot;&quot;

    def __init__(self, *, retry_times=3, wait_secs=5, error=(Exception, )):
        &quot;&quot;&quot;
    ...]]></description><category></category></item><item><title><![CDATA[自己定义一个加减乘除函数，以及lambda函数的用法]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80589230</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80589230</guid><author>hello_syt_2018</author><pubDate>Wed, 06 Jun 2018 00:26:16 +0800</pubDate><description><![CDATA[使用lambda函数实现一个加减乘除函数的定义

def calc(num_list, fn):
    result = num_list[0]
    for index in range(1, len(num_list)):
        result = fn(result, num_list[index])

    return result


def main():
    my...]]></description><category></category></item><item><title><![CDATA[python -- 异步I/O]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80589183</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80589183</guid><author>hello_syt_2018</author><pubDate>Wed, 06 Jun 2018 00:19:32 +0800</pubDate><description><![CDATA[异步操作目的是使用一个主线程实现多个协程并发执行

定义一个函数，该函数是一个消费者的生成器，使用装饰器@asyncio.coroutine 把生成器变成协程，协程的程序是可以中断再执行的，异步操作需要在协程中中通过yield from完成；yield from语法可以让我们方便地调用另一个generator，生成器既可以是生产者也可以是消费者，当一个任务的程序执行到这里时，会中断程序，调用其他的...]]></description><category></category></item><item><title><![CDATA[python中文件的I/O操作]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80586262</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80586262</guid><author>hello_syt_2018</author><pubDate>Tue, 05 Jun 2018 19:54:35 +0800</pubDate><description><![CDATA[简介


I/O – Input/Output  输入/输出
读写文件是最常见的IO操作，Python内置了读写文件的函数

读 -- 输出
写 -- 输入

在磁盘上读写文件的功能都是由操作系统提供的，操作系统是不允许普通程序直接操作磁盘的，所以，想要读写文件，需要请求操作系统打开一个文件对象，然后通过操作系统提供的接口从这个文件对象中读取数据（读文件）或者 把数据写入这个文件（写文件）



...]]></description><category></category></item><item><title><![CDATA[协程和异步I/O]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80585441</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80585441</guid><author>hello_syt_2018</author><pubDate>Tue, 05 Jun 2018 18:32:34 +0800</pubDate><description><![CDATA[协程概念理解


协程，又称微线程，纤程。英文名Coroutine；
协程就是两个函数之间的协作运行，故称之为协程；
协程的特征：假如两个函数 A和B ， A执行到某行程序中断，执行B，B执行到某行程序中断执行A，然后循环下去
函数内部的中断和函数之间的更替执行，是靠send  和 yield 实现的 
send发送消息给yield，并且中端程序的执行， yield不仅可以接收send发送的消息还...]]></description><category></category></item><item><title><![CDATA[python中使用redis、和 mongodb数据库]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80573168</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80573168</guid><author>hello_syt_2018</author><pubDate>Mon, 04 Jun 2018 21:11:44 +0800</pubDate><description><![CDATA[在python中使用redis和mongodb数据库，其中操作命令是一样的，不同的是，在使用命令时需要加上创建的连接的对象



python中使用redis数据库：


首先要创建一个redis连接对象：

redis_client = redis.Redis(host='112.74.171.100', port=6379,password='xxx')

然后就可以使用redis操作命令了
...]]></description><category></category></item><item><title><![CDATA[爬虫 数据库中存取内容]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80548741</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80548741</guid><author>hello_syt_2018</author><pubDate>Sat, 02 Jun 2018 15:55:07 +0800</pubDate><description><![CDATA[使用redis 、 mongodb数据库中 存取 爬取页面的内容



import pickle
import zlib
from enum import Enum, unique
from hashlib import sha1
from random import random
from threading import Thread, current_thread
from time im...]]></description><category></category></item><item><title><![CDATA[爬虫多线程]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80537729</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80537729</guid><author>hello_syt_2018</author><pubDate>Fri, 01 Jun 2018 14:55:41 +0800</pubDate><description><![CDATA[定义多线程类， 爬虫类 爬取 m.sohu.com的内容



import logging
from enum import unique, Enum
from queue import Queue
from random import random
from threading import current_thread, Thread
from time import sleep
from ...]]></description><category></category></item><item><title><![CDATA[pycharm的使用]]></title><link>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80533206</link><guid>https://blog.youkuaiyun.com/hello_syt_2018/article/details/80533206</guid><author>hello_syt_2018</author><pubDate>Fri, 01 Jun 2018 09:19:03 +0800</pubDate><description><![CDATA[安装第三包时，不在terminal终端安装，在settings–&amp;amp;amp;amp;amp;gt; 项目解释器–&amp;amp;amp;amp;amp;gt;显示解释器下的安装包的右边窗口 + 号按钮 搜索安装

为了防止找不到，不能识别的错误等，要修改下 
pycharm2017/helpers/packaging_tool.py文件：


修改如下：

def do_install(pkgs):
    try:
        from pip impo...]]></description><category></category></item></channel></rss>