自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(15)
  • 收藏
  • 关注

原创 解决raise ValueError(“{0} is not supported“.format(y_type)) ValueError: unknown is not supported

修改lib/python3.7/site-package/torch/tensor.pyreturn self.cpu().detach().numpy()

2022-05-08 20:00:31 3078 2

原创 使用Colab运行pytorch文件

#1. 查看pytorch版本:import torchprint(torch.__version__)#2.查看cuda版本:print(torch.version.cuda)from google.colab import drivedrive.mount('/content/drive/')!pip install torch==1.10.2 torchvision==0.11.3 -f https://download.pytorch.org/whl/torch_stable..

2022-05-05 18:28:11 1806

原创 解决selenium碰到不同的xpath的办法

不同页面同一个位置,xpath不同,导致无法一次性提取,解决办法,用try函数,找不到就换另一个try: title = web.find_element_by_xpath('/html/body/div[4]/div[2]/div[1]/div[1]/h1').textexcept: title = web.find_element_by_xpath('//*[@id="title"]').text # // *[ @ id = "content"] //*[@id="c

2022-04-18 16:34:36 892

原创 selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate elemen

错误原因有两个:1、元素重叠 2、时间问题解决方法:time.sleep()# 或者button = driver.find_element_by_xpath("xpath"]")driver.execute_script("arguments[0].click();", button)

2022-04-17 19:23:09 686

原创 SyntaxError: Non-UTF-8 code starting with ‘\xbf‘ in file A:/MyInstall/

写程序突然提示SyntaxError: Non-UTF-8 code starting with '\xbf' in file A:/MyInstall/解决办法在第一行加上# coding=gbk

2022-04-17 16:21:25 1029

原创 beautifulsoup抓取< record >

写了个爬爬去标题和内容,用bs4获取a标签的href和text时,获取不到,网页源代码如下去解决办法:利用remain_page = BeautifulSoup(resp.text,"html.parser") #audit_div = main_page.find("div",attrs={"class":"ny-list"})audit_div = main_page.find("div", attrs={"id": "4009681"})obj = re.compile.

2022-04-17 15:11:19 612

转载 easyui input赋值

easyui-textbox <input id="addSnumber" style="width: 200px; height: 30px;" class="easyui-textbox" type="text"   name="snumber" data-options="required:true, missingMessage:'请输入学号'" /> 赋值的方式: //使用表单选择器:代码似乎是有异常的 //$("input[name='snumber']").te.

2022-04-09 20:35:54 1347

原创 Flask跨域请求

from flask_cors import CORSCORS(app,supports_credentials=True)加上上面两行就行

2022-04-09 20:31:24 787

原创 ValueError: The least populated class in y has only 1 member, which is too few. The minimum number o

在切分数据集时提示:ValueError: The least populated class in y has only 1 member, which is too few. The minimum number of groups for any class cannot be less than 2.ValueError:y中填充最少的类只有1个成员,这太少了。任何类别的最小组数不能少于2个检查数据集发现最小的分类只有1个解决方法:删掉最小的分类或者填充一个数据...

2022-04-08 14:18:16 9107 2

原创 使用python处理txt到csv

代码如下import osimport pandas as pdimport re# 获取目标文件夹的路径filedir = 'D:\xxxx'# 获取当前文件夹中的文件名称列表filenames = os.listdir(filedir)# 打开当前目录下的result.txt文件,如果没有则创建post_title = []post_kind = []post_content = []i = 0# 先遍历文件名for filename in filenam...

2022-03-14 17:16:00 709

原创 解决(“settings.DATABASES is improperly configured. “django.core.exceptions.Im

django 连接mysql ,在terminal输入python manage.py migrate的时候报错raise ImproperlyConfigured("settings.DATABASES is improperly configured. "django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value.

2021-12-28 21:10:28 4804 2

原创 解决 ModuleNotFoundError: No module named ‘pip‘问题

利用pycharm pip install bs4时报以下错误,之前安装request时没有出问题解决方法:打开setting --project interpretor 底下会提示有个模块没有安装,然后安装完,再去执行pip install 就可以了 然后就可以安装了...

2021-12-08 14:49:01 727

转载 Java中Interator与listinterator

1.IteratorIterator的定义如下:public interface Iterator<E> {}Iterator是一个接口,它是集合的迭代器。集合可以通过Iterator去遍历集合中的元素。Iterator提供的API接口如下:forEachRemaining(Consumer<? super E> action):为每个剩余元素执行给定的操作,直到所有的元素都已经被处理或行动将抛出一个异常hasNext():如果迭代器中还有元素,则返回true。

2021-11-10 15:09:44 278

原创 Access denied for user ‘root‘@‘localhost‘ (using password: YES)

密码错误导致的mysql连接不上,密码错误分为以下几种情况: (1)控制台报错信息中有:Access denied for user 'root'@'localhost' (using password: YES),这句话的意思是说,你在连接数据库的地方配置了密码,但是密码错误。 (2)控制台报错信息中有:Access denied for user 'root'@'localhost' (using password: NO),这句话的意思是说,你在连接数据库的地方没有配置密码,但是mysql..

2021-11-01 10:49:11 833

转载 修改Mysql密码

在 Navicat for MySQL 下面直接执行 SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass'); 就可以方法1: 用SET PASSWORD命令  mysql -u root  mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');方法2:用mysqladmin  mysqladmin -u root password "new...

2021-11-01 10:46:27 84

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除