python
python
永远喜欢薇尔莉特
这个作者很懒,什么都没留下…
展开
-
python发送邮件
#!/usr/bin/python# -*- coding: UTF-8 -*- import smtplibfrom email.mime.text import MIMETextfrom email.header import Header # 第三方 SMTP 服务mail_host="smtp.XXX.com" #设置服务器mail_user="XXXX" #用户名mail_pass="XXXXXX" #口令 sender = '[email protected]原创 2021-05-28 18:54:59 · 233 阅读 · 0 评论 -
天天基金爬虫
import requestsfrom bs4 import BeautifulSoupimport pymysqlpymysql.install_as_MySQLdb()def details(url): response = requests.get(url) response.encoding = response.apparent_encoding text = response.text beautifulSoup = BeautifulSoup(tex原创 2021-05-26 21:50:51 · 568 阅读 · 0 评论 -
python requests 乱码
response=requests.get('www.test.com')response.encoding = response.apparent_encoding原创 2021-05-26 21:00:59 · 117 阅读 · 0 评论 -
python gui Tkinter
Tkinter入门小程序示例代码import tkinter# 创建窗口对象tk = tkinter.Tk()# 创建两个列表组件list_box_1 = tkinter.Listbox(tk)list_box_2 = tkinter.Listbox(tk)# 初始化两个数组li = ['C', 'python', 'php', 'html', 'SQL', 'java']movie = ['CSS', 'jQuery', 'Bootstrap']# 给第一个列表组件插入数据原创 2021-05-01 02:20:54 · 236 阅读 · 1 评论 -
使用当前python的版本安装pip
python -m pip install 模块名原创 2021-04-30 17:06:19 · 213 阅读 · 1 评论 -
mac设置默认python
研究python爬虫,需要用到Beautiful Soup但是Mac默认的python版本为2.7 自己安装了3.6的版本import 报错查找资料:Mac在启动,会先加载系统配置文件(包括~/.bash_profile ),所有默认的命令的路径,将会配配置文件 (比如:~/.bash_profile)中的路径覆盖,并且,是后面覆盖前面的路径:例如,在终端输入“python”, 系统会在配置文件中的路径查找,一直到找到位置(在配置文件中从后向前找)强烈建议不要直接sudo ln ‑s (会直接覆盖原创 2021-04-30 16:53:30 · 625 阅读 · 2 评论 -
爬虫
Write a program to scrape https://github.com, using requests and Beautiful Soup. The goal is to get, for a given GitHub username, i.e., https://github.com/google, a list of repositories with their GitHub-assigned programming language, the number of forks a原创 2021-04-29 13:16:44 · 167 阅读 · 0 评论 -
csv编码格式转换utf-8
使用excel打开csv文件。另存为CSV UTF-8(逗号分隔)(.csv)即可。原创 2021-04-19 16:38:48 · 2390 阅读 · 0 评论 -
python读写csv
总述:这篇博客讲述python怎样创建,读写,追加csv文件原文地址https://blog.csdn.net/lwgkzl/article/details/82147474创建:利用csv包中的writer函数,如果文件不存在,会自动创建,需要注意的是,文件后缀一定要是.csv,这样才会创建csv文件这里创建好文件,将csv文件的头信息写进了文件。import csvdef create_csv(): path = "aa.csv" with open(path,'wb'转载 2021-04-19 15:12:26 · 109 阅读 · 0 评论 -
确定有限状态自动机(deterministic finite automaton --> DFA)
确定有限状态自动机(deterministic finite automaton --> DFA)总结创建一个程序,该程序将输入确定性有限状态自动机(DFA)的定义,并处理一些字符串,以确定这些字符串是否是DFA所识别的语言的一部分。细节编写一个Java命令行程序,首先提示用户输入文件名。这个文件将被程序读入。该文件将包含对 DFA 的描述和一些要由 DFA 计算的未知数量的字符串。对于每个字符串,程序将模拟该字符串上的 DFA 。在下面一行打印带有"ACCEPT"或"REJECT"原创 2021-04-12 23:26:42 · 855 阅读 · 2 评论 -
pip安装离线安装包
pip安装离线依赖包第一步,打开仓库网站https://pypi.org/。第二步,搜索进入对应的依赖仓库。第三步,找到历史版本。第四步,点击下载所有文件。第五步,下载对应whl文件。第六步,本地安装,记得必须使用国内的镜像来源,并且设置域名可信任。pip install tensorflow-1.15.5-cp37-cp37m-win_amd64.whl -i http://pypi.douban.com/simple --trusted-host pypi.douban.com原创 2021-04-14 01:49:20 · 928 阅读 · 0 评论 -
bert --> 文本分类
github地址https://github.com/google-research/bert准备工作## Required parameters## 数据集:包含训练数据集、验证数据集和预测数据集(附件可下载)flags.DEFINE_string( "data_dir", "数据文件/tmp", "The input data dir. Should contain the .tsv files (or other data files) " "for the tas转载 2021-04-15 02:47:20 · 702 阅读 · 1 评论 -
mplfinance
Project descriptionmplfinancematplotlib utilities for the visualization, and visual analysis, of financial dataInstallationpip install --upgrade mplfinancemplfinance requiresmatplotlibandpandas⇾Latest Release Information⇽Contents and...原创 2021-04-10 12:28:35 · 800 阅读 · 0 评论 -
基于市场情绪平稳度的股指期货日内交易策略
基于市场情绪平稳度的股指期货日内交易策略策略分析请下载这个pdf测试数据请下载这个csv文件编程难点平均最大回撤和平均最大反向回撤的计算累计收益的计算代码实现(使用python实现,其他编程语言大概一致)# 处理csvimport csv# 绘制折线图import matplotlib.pyplot as plt# 绘制折线图from matplotlib.ticker import MultipleLocator# 以日期分组数据def group_data_by_原创 2021-04-09 11:53:49 · 1535 阅读 · 1 评论