- 博客(88)
- 收藏
- 关注
原创 ValueError: Shapes (2, 1, 10, 100) and () are incompatible
将文件38行 grad = tf.concat(0, grads)改为 grad = tf.concat(grads, 0)即可
2019-12-31 13:30:27
5806
1
原创 编译找不到头文件
报错:omnisky@omnisky:~/xy/12/spdylay-master/python$ python setup.py build_extrunning build_extbuilding 'spdylay' extensionx86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototy...
2019-12-13 16:59:13
650
原创 字符串转为整数计算
#include<stdio.h>#include<stdlib.h>int main(){ char sign = '+'; char addnum1[] = "1"; char addnum2[] = "2"; int res = 0; switch(sign) { case '+': ...
2019-12-10 16:01:16
253
原创 anaconda的简单使用
安装: 双击Anaconda3-5.0.0-Windows-x86_64.exe文件根盘下建一个anaconda文件夹添加环境变量 E:\anaconda E:\anaconda\Scripts 可视化页面Launch启动 内容保存桌面,这个服务器找不到其它盘或者小黑屏启动 输入命令:(base) C:\Users\xiaoy...
2019-12-04 22:12:44
715
原创 C语言调用另一个源文件里的函数
fuTest.c#include<stdio.h> void FuTest1(){ printf("%s", "test1"); } void FuTest2(){ printf("%s", "test2"); } void FuTest3(){ printf("%s", "test3"); ...
2019-11-20 17:57:52
820
原创 缺失数字(力扣)
加一个开关(true false)int missingNumber(int* nums, int numsSize){ for(int i=0; i<=numsSize; i++) { bool a = true; for(int j=0; j<numsSize; j++) { if(i ==...
2019-11-15 14:40:12
212
原创 Spider古诗词
# coding: utf-8import urllib.requestfrom bs4 import BeautifulSoupimport ioimport syssys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='gb18030')# http://www.shicimingju.com/book/sanguoy...
2019-11-06 20:08:11
185
原创 bs4学习
https://beautifulsoup.readthedocs.io/zh_CN/v4.4.0/# coding: utf-8from bs4 import BeautifulSouphtml_doc = """<html><head><title>The Dormouse's story</title></head> ...
2019-11-06 18:30:38
213
原创 re爬取糗图
import urllib.requestimport reimport osimport time# 输入起始页码和结束页码start_page = int(input('请输入起始页码-'))end_page = int(input('请输入结束页码-'))#https://www.qiushibaike.com/pic/page/2/url = 'https://www.q...
2019-10-31 18:55:56
695
原创 re学习(二)
(1)单字符匹配 \d 0-9 [0-9] \D 除了\d \w 数字、字母、下划线、一个中文 [0-9a-zA-Z_] \W 除了\w \s 匹配所有的空白字符,比如空格,\t \r \n \S 除了\s . 可以任意字符,除了 \n [...
2019-10-29 08:29:42
248
原创 re学习(一)
# coding: utf-8import re'''re.match()re.search() 返回的都是一个对象,obj.group()re.findall() 返回的是一个列表re.compile()re.sub()'''string = '<div>浪花淘尽英雄,是非成败转头空!</div></div></div...
2019-10-28 21:12:19
358
原创 使用cookie模拟登陆
访问登录后的页面(1)抓包,抓取浏览器的cookie值,然后到代码中应用import urllib.requesturl = 'http://www.renren.com/960481378/profile'headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHT...
2019-10-25 08:51:05
660
原创 代理--ip池的使用--阿布云的使用
代理import urllib.requestproxy = { "http": "34.84.238.121"}url = "https://www.baidu.com/s?ie=UTF-8&wd=ip"handler = urllib.request.ProxyHandler(proxies=proxy)opener = urllib.request.build...
2019-10-23 18:17:04
977
原创 Handler处理器、自定义Opener
在请求里面,还有两个高级功能,一个是代理,一个是cookie,学习handler和opener使用的步骤: 见代码# coding: utf-8import sysimport iosys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='gb18030')import urllib.requesturl = 'http:...
2019-10-18 09:34:43
161
原创 爬虫异常处理
# coding: utf-8import urllib.requestimport urllib.errorurl = "https://www.cnblogs.com/"try: response = urllib.request.urlopen(url)except urllib.error.HTTPError as e: print(e)except url...
2019-10-18 08:53:48
243
原创 爬取百度贴吧
#coding: utf-8import urllib.requestimport urllib.parseimport time# http://tieba.baidu.com/f?kw=python&ie=utf-8&pn=0# http://tieba.baidu.com/f?kw=python&ie=utf-8&pn=50# http://ti...
2019-10-17 22:26:27
281
原创 字符串匹配算法(KMP算法)
力扣实现 strStr() 函数。给定一个 haystack 字符串和一个 needle 字符串,在 haystack 字符串中找出 needle 字符串出现的第一个位置 (从0开始)。如果不存在,则返回 -1。int strStr(char * haystack, char * needle){ int i = 0; int j = 0; int h_le...
2019-10-17 17:50:37
193
原创 模拟各种请求方式(二)
ajax-post:# coding: utf-8import urllib.requestimport urllib.parseurl = "http://www.kfc.com.cn/kfccda/ashx/GetStoreList.ashx?op=cname"cname = input("请输入当前城市:")formdata = { 'cname': cname, ...
2019-10-17 08:18:43
256
原创 模拟各种请求方式(一)
get请求:# coding: utf-8import urllib.requestimport urllib.parse# https://www.baidu.com/s?ie=UTF-8&wd=%E6%97%A5%E6%9C%ACkeyword = input("请输入关键字:")url = "https://www.baidu.com/s?"data = { ...
2019-10-15 09:24:27
612
原创 编码转换及拼接
#coding: utf-8import urllib.parseurl = "https://www.baidu.com/s?ie=UTF-8&wd=美女"print(urllib.parse.quote(url)) # https%3A//www.baidu.com/s%3Fie%3DUTF-8%26wd%3D%E7%BE%8E%E5%A5%B3string = url...
2019-10-13 16:50:46
511
原创 防盗链
#coding:utf-8import urllib.request"""# 下载普通图片url = "http://pic22.nipic.com/20120725/9676681_001949824394_2.jpg"response = urllib.request.urlopen(url)with open("k.jpg", "wb")as fp: fp.write(r...
2019-10-13 16:02:49
307
原创 http协议及抓包工具
http协议 网站的工作原理:见图形 url介绍: 一个完整的url: http://www.baidu.com:80/index.html?username=goudan&password=123#lala 协议 主机 端口 请求资源 参数(query_string) 锚点 h...
2019-10-12 09:10:35
606
原创 urllib.request.urlretrieve及添加headers
下载图片:import urllib.request# url = "http://www.baidu.com/"## response = urllib.request.urlretrieve(url, "hh.html")## print(response)image_url = "https://img04.sogoucdn.com/net/a/04/link?url=ht...
2019-10-12 09:02:47
2361
原创 urllib库解析
# coding:utf-8import urllib.requesturl = "https://www.baidu.com"response = urllib.request.urlopen(url)print(response) # 内存地址print(response.url) # 打印urlprint(response.status) # 200#prin...
2019-10-10 17:29:54
198
原创 整数转换为字符串(附上力扣代码)
#include<stdio.h>#include<stdlib.h>#pragma warning(disable: 4996)int main() { int number = 1234; char string[12] = { 0 }; itoa(number, string, 10); printf("Num:%d; Str:%s\n", numb...
2019-10-08 17:35:22
426
原创 python manage.py db init Please edit configuration/connection/logging settings in python manage.p
将模型中的类与视图相关联即可或者在manage.py中导入
2019-04-10 11:01:45
2226
原创 pycharm导入模块一直显示不存在(ImportError:No module named cdn.cdn_client)
不同级目录的导入 目录下必须有__init__文件(可为空)路径:import syssys.path.append("C:/Users/xiaoyu/Desktop/learn/bce-python-sdk-0.8.27/baidubce/services/cdn"若还是不行则:解决:pycharm不会将当前文件目录自动加入自己的sourse_path。右键make_directo...
2019-04-08 17:57:37
623
原创 ImportError: No module named Crypto.Cipher
pip uninstall cryptopip unijstall pycrypto#重新安装pip install pycrypto若安装pycrypto一直报错,无法安装,导致from Crypto.Cipher import AES也无法使用可以使用下面的语句安装pycryptodome这个库pip install pycryptodome...
2019-04-08 17:40:11
421
原创 C:\Users\Administrator\Desktop\xiaoyu\project>python 'python' 不是内部或外部命令,也不是可运行的程序 或批处理文件。
环境变量中添加路径 C:\Users\Administrator\AppData\Local\Programs\Python\Python36\
2019-03-14 14:26:39
4275
原创 Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.
直接在install的后边加上 --user#只为当前用户安装: pip install –user报错:ackages/64/a6/d7b6fb7bd0a4680a41f1d4b27061c7b768c673070ba8ac116f865de4e7ca/billiard-3.3.0.23.tar.gz (Caused by ConnectTimeoutError(&lt;pip._ve...
2019-03-13 22:19:06
4085
原创 redis make test 出现警告解决
解决:更改 tests/integration/replication-psync.tcl 文件:vi tests/integration/replication-psync.tcl将after后面的数字,从100改成 500安装tclsudo make test```
2019-03-10 19:54:55
1515
原创 Field name `m_languge` is not valid for model `Movie`
···字段无意义 可能是模型与json数据互转有错,serializers···
2019-03-08 14:53:56
556
原创 输入某年某月某日,判断这一天是这一年的第几天
import datetimedef day_year(): year = input("请输入年份:") month = input("请输入月份") day = input("请输入日期:") date1 = datetime.date(year=int(year),month = int(month),day = int(day)) date2 =...
2018-11-25 21:46:10
343
原创 GitHub的使用
1.git 管理代码的工具2.安装git sudo apt install git git --version3.配置git 指定你的名字 git config --global user.name 你的名字 指定邮箱 git config --global user.email 你的邮箱4.git工作过程 先从工作区add到暂存区,再从暂存区commit到分支 默认有...
2018-11-08 21:54:26
189
原创 http协议与过程
1、什么是HTTP协议?1)是基于请求与响应的应用层协议,底层协议TCP保证了数据可靠传输2)通过url进行客户端与服务器之间的数据交互3)是一种C/S(B/S)模式的协议,客户端向服务器发起请求,服务器处理请求并且返回响应4)该协议是一种无状态的协议(不会记录用户的访问状态)C/S模式Client/Server;即客户端/服务器 交互性强 提供了更安全的存取模式B/S模式B...
2018-11-08 21:51:18
811
原创 手动创建Python3.6环境
‘’’sudo apt updatesudo apt install software-properties-commonsudo add-apt-repository ppa:jonathonf/python-3.6sudo apt updatesudo apt install python3.6cd /usr/binls | grep pythonsudo rm python...
2018-11-02 22:01:14
444
原创 安装虚拟环境
'''安装sudo pip install virtualenvsudo pip install virtualenvwrappermkdir ~/.virtualenvssudo vim ~/.bashrc 末尾添加 export WORKON_HOME=$HOME/.virtualenvs source /...
2018-11-02 21:59:40
152
原创 站点的应用 admin
安装 pip install django-tinymce注册应用INSTALLED_APPS = [‘django.contrib.admin’,‘django.contrib.auth’,‘django.contrib.contenttypes’,‘django.contrib.sessions’,‘django.contrib.messages’,‘django.co...
2018-11-01 21:02:41
217
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人