上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 19 下一页
摘要: 在介绍yield前有必要先说明下Python中的迭代器(iterator)和生成器(constructor)。 一、迭代器(iterator) 在Python中,for循环可以用于Python中的任何类型,包括列表、元祖等等,实际上,for循环可用于任何“可迭代对象”,这其实就是迭代器 迭代器是一个 阅读全文
posted @ 2017-03-21 10:25 疯陈演义 阅读(257) 评论(0) 推荐(0)
摘要: 1. 什么是装饰器? 顾名思义,装饰器就是在方法上方标一个带有@符号的方法名,以此来对被装饰的方法进行点缀改造。 当你明白什么是装饰器之后,自然会觉得这个名字取得恰如其分,但作为初学者来说多少还是会有些迷茫。下面用代码来说明怎么理解装饰器。 Python允许将方法当作参数传递,因此以上脚本就是将ta 阅读全文
posted @ 2017-03-07 12:17 疯陈演义 阅读(207) 评论(0) 推荐(0)
摘要: CentOS6.x 安装升级Python2.7.x Python3.4.x 2015-06-07• CentOS、Linux • 评论关闭 CentOS release 6.6 (Final) 安装升级Python2.7.7 Python2.7.9 Python3.4.3 1、查看当前系统中的pyt 阅读全文
posted @ 2017-01-22 22:13 疯陈演义 阅读(1062) 评论(0) 推荐(0)
摘要: def strPaiXu(p): s = '' a = [ord(i) for i in p] #a = list(map(ord,p)) a.sort() p = [chr(i) for i in a] for i in p: s += i return s 阅读全文
posted @ 2017-01-03 20:32 疯陈演义 阅读(121) 评论(0) 推荐(0)
摘要: # -*- coding: utf-8 -*- import os import pandas as pd # ========== 遍历数据文件夹中所有股票文件的文件名,得到股票代码列表stock_code_list stock_code_list = [] for root, dirs, files in os.walk('all_stock_data'):# 注意:这里请填写数据文件在... 阅读全文
posted @ 2017-01-01 13:16 疯陈演义 阅读(822) 评论(0) 推荐(0)
摘要: import urllib.request import re ##def downback(a,b,c): ## '''' ## a:已经下载的数据块 ## b:数据块的大小 ## c:远程文件的大小 ## ''' ## per = 100.0 * a * b / c ## if per > 100 : ## per = 100 ## ... 阅读全文
posted @ 2017-01-01 12:14 疯陈演义 阅读(11139) 评论(0) 推荐(0)
摘要: import urllib.request import re stock_CodeUrl = 'http://quote.eastmoney.com/stocklist.html' #获取股票代码列表 def urlTolist(url): allCodeList = [] html = urllib.request.urlopen(url).read() html... 阅读全文
posted @ 2016-12-25 13:41 疯陈演义 阅读(4843) 评论(7) 推荐(0)
摘要: import smtplib from email.mime.text import MIMEText from email.header import Header # 第三方 SMTP 服务 mail_host="smtp.qq.com" #设置服务器 mail_user="xxxxxx" #用户名 mail_pass="xxxx" #口令QQ需要授权码 sender =... 阅读全文
posted @ 2016-12-18 19:13 疯陈演义 阅读(280) 评论(0) 推荐(0)
摘要: void charu(int x[],int w[],int b,int op); int main() { int arr[5] = {20,80,88,98,179}; int ar[6]; int i,b=50; int c; c = sizeof(arr)/sizeof(arr[0]); charu(arr,ar,b,c); ... 阅读全文
posted @ 2016-12-16 20:58 疯陈演义 阅读(1181) 评论(0) 推荐(0)
摘要: int arr[8]={12,53,71,9,6,3,4,8}; int i,j,t; for(j=0;jarr[i+1]) { t = arr[i]; arr[i]=arr[i+1]; arr[i+1]=t; } } ... 阅读全文
posted @ 2016-12-08 18:03 疯陈演义 阅读(139) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 19 下一页