RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-347484

Raharasomaha's questions

Martin Hope
Raharasomaha
Asked: 2022-02-17 17:52:19 +0000 UTC

DB::Exception:PREWHERE 中的过滤器类型无效:Array(String)(版本 21.1.3.32(官方构建))

  • 0

clickhouse里面有一张表,我用extract方法执行下面的查询。

select * from posts where extract(text,'(виртуальны\w{,4}\s|дата-центр\w{,4}\s)') LIMIT 200

执行请求时,出现如下错误:

Code: 59, e.displayText() = DB::Exception: Invalid type for filter in PREWHERE: Array(String) (version 21.1.3.32 (official build))

谷歌谷歌没有给出答案,我以为是正则表达式错误,但我通过这个网站检查了正则表达式。我究竟做错了什么 ?

регулярные-выражения
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-04-23 23:17:48 +0000 UTC

如何改进功能

  • 0
def generate_date():
    date_data = []
    day_delta = datetime.timedelta(days=1)
    start_date = dateparser.parse('2020-03-01').date()
    end_date = start_date + 30 * day_delta
    for i in range((end_date - start_date).days):
        date_result = (start_date + i * day_delta)
        date_data.append(date_result)
return date_data

有一个函数可以在某个日期之后生成 30 天。如何修改此函数,以便从某个日期到今天生成日期?

python
  • 2 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-01-02 13:48:48 +0000 UTC

如何更改 sublimetext3 顶部侧边栏的颜色?

  • 0

目前我有这个问题。 在此处输入图像描述

而我不喜欢这一刻 在此处输入图像描述

如何通过将颜色从白色更改为黑色来更改它,使其看起来像这样: 在此处输入图像描述

sublime-text-3
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-12-28 22:24:52 +0000 UTC

在 python 中解析带有 SPA 的站点的最佳方法是什么?

  • 0

有这样一个 网站,我想用这个链接解析这个播放器的数据

我为此编写了这段代码:

import requests
from bs4 import BeautifulSoup


def get_html():
    r = requests.get(url='https://www.atptour.com/en/players/felix-auger-aliassime/ag37/overview')
    return r.text
html = get_html()

def get_career(html):
    soup = BeautifulSoup(html, 'lxml')
    career = soup.find('tr')
    print(career)


get_career(html)

但事情是这样的,我正在解析的链接是一个单页应用程序,因此,我需要的数据在此处输入图像描述 没有出现在页面的完整 html 代码中。

使用 SPA 抓取网站的最佳方法是什么?

python
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-10-25 18:36:30 +0000 UTC

如何将日期时间转换为感知日期时间?

  • 2

我得到以下日期:2019-10-11 12:33:42,它包含类型datetime.datetime。

我怎样才能将其转换为aware datetime?

阅读文档后,我没有找到任何东西。只有这个选项:datetime.now(timezone.utc)

试图这样做,翻译成aware datetime,但它不起作用。

aware_datetime = datetime(date_parsed, timezone.utc)

该变量date_parsed包含以下日期:2019-10-11 12:33:42

如何才能做到这一点?

python
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-10-22 21:59:59 +0000 UTC

AttributeError:“str”对象没有属性“strftime”

  • 1

这是一个回溯:

 File "C:\Users\PycharmProjects\oop_parser\boilerpipe_parser_component.py", line 116, in get_nd_date
    unix_date = date_parsed.strftime('%Y-%m-%d %H:%M:%S')  # < Конвертируем дату в формат datetime
AttributeError: 'str' object has no attribute 'strftime'

Process finished with exit code 1

编码:

unix_date = date_parsed.strftime('%Y-%m-%d %H:%M:%S')

一般来说,unix_date只应该进入一个变量class 'datetime.datetime',但是,根据错误判断,一个字符串会进入它。我检查了它 - 结果是,结果出现了一个错误。

这时,我想到了数据类型检查。那是这样的:

if type(date_parsed) == datetime.datetime: 
   unix_date = date_parsed.strftime('%Y-%m-%d %H:%M:%S')

还有什么办法可以解决这个问题?

UPD:我的方法的完整代码:

@staticmethod
    def get_nd_date(date_parsed):
        """Получение UNIX даты."""
        Try:
            unix_date = date_parsed.strftime('%Y-%m-%d %H:%M:%S')  # < Конвертируем дату в формат datetime
            nd_date = time.mktime(time.strptime(unix_date, '%Y-%m-%d %H:%M:%S'))  # < Конвертированную дату  конвертируем в формат UNIX.
            return nd_date
        except AttributeError:
            return "" 
python
  • 2 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-10-15 14:35:51 +0000 UTC

如何在pycharm的主菜单中添加vcs?

  • 1

如何将 vcs 菜单添加到 paycharm,使其如下所示: 在此处输入图像描述

目前我有这个: 手臂

也就是说,我希望菜单栏在第一个屏幕上显示 VCS 字样,如何做到这一点?

pycharm
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-10-12 15:35:55 +0000 UTC

如何编写带条件的sql查询?

  • 0

我无法理解如何创建一个sql update不会更新所有 2 列但仅更新这两列的最后记录的查询。

试图这样做:

UPDATE logs SET e_date = %s, duration = %s WHERE max(e_date, duration)
mysql
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-10-08 12:51:52 +0000 UTC

设置 PyCharm + GitHub

  • 0

如何使用 PyCharm 创建和设置同步 GitHub 存储库。谷歌没有给出明确的答案(也许我看起来很糟糕)。如何正确配置 PyCharm,以便将您创建的项目保存到 GitHub。我在三台电脑上工作(在工作中,在家里),所以我想设置一次,这样我就可以来,坐下,然后立即上班。

UPD:根据下面评论的建议,我查看了 VCS,在我看来,这不是它。 在此处输入图像描述

github
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-10-07 14:22:09 +0000 UTC

在 python 中形成 SQL 查询

  • 2

我正在循环执行以下代码:

sql = '''INSERT INTO items (res_id, log_id, link, title, content, n_date, nd_date, s_date, not_date)'''
                        values = ''' VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ''' % (
                                res_id,
                                log_id,
                                resource_link,
                                item_title,
                                item_content,
                                n_date,
                                nd_date,
                                s_date,
                                not_date)
                        result = sql + values

结果,目前我result存储了以下数据:

INSERT INTO items (res_id, log_id, link, title, content, n_date, nd_date, s_date, not_date) VALUES ('35', '1', 'http://bryansk-news.net/society/2019/10/07/37428.html', 'бла-бла'
', 'Added by Raha', '1570402602', '1570429215.989103', '2019-10-07') 
INSERT INTO items (res_id, log_id, link, title, content, n_date, nd_date, s_date, not_date) VALUES ('35', '1', 'http://bryansk-news.net/society/2019/10/07/37429.html', 'бла-бла'
', 'Added by Raha', '1570402845', '1570429217.0539544', '2019-10-07') 

我需要数据是这样的:

INSERT INTO items (res_id, log_id, link, title, content, n_date, nd_date, s_date, not_date) VALUES ('35', '1', 'http://bryansk-news.net/society/2019/10/07/37428.html', 'бла-бла'
', 'Added by Raha', '1570402602', '1570429215.989103', '2019-10-07') 
VALUES ('35', '1', 'http://bryansk-news.net/society/2019/10/07/37429.html', 'бла-бла'
', 'Added by Raha', '1570402845', '1570429217.0539544', '2019-10-07') 

我怎样才能做到这一点? UPD:第一个变体和第二个变体之间的区别在于,在第一个变体中它INSERT INTO出现了 2 次。在第二INSERT INTO个变体中它只出现了 1 次,在第二个变体中它VALUES也出现了 1 次

python
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-10-04 12:52:15 +0000 UTC

如何使多个插入一条记录?

  • 1

有这样一个请求:

self.cursor.execute('''INSERT INTO items (res_id, log_id, link, title, content, n_date, nd_date, s_date, not_date)
                       VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)''',
                       ( res_id,
                         log_id,
                         str(resource_link),
                         str(item_title),
                         str(item_content),
                         str(n_date),
                         nd_date,
                         s_date,
                         not_date
                       )
                                )

我怎样才能让这个查询一次添加一条新闻,而不是一次添加 100 条新闻?

insert我在网上看了这样一个复数的例子:

INSERT INTO MyTable
  ( Column1, Column2, Column3 )
VALUES
  ('John', 123, 'Lloyds Office'), 
  ('Jane', 124, 'Lloyds Office'), 
  ('Billy', 125, 'London Office'),
  ('Miranda', 126, 'Bristol Office');

但在这种情况下,您需要根据需要指定VALUES多次。

python
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-10-02 16:07:25 +0000 UTC

如何在python中保护sql插入免受sql注入?

  • 1

如何保护这样的插入查询免受 sql 注入?我正在使用带有 pymysql 库的 python 3.7 和 mysql 5.7 db。这是要保护的代码:

self.cursor.execute('''INSERT INTO items (res_id, log_id, link, title, content, n_date, nd_date, s_date, not_date)
                       VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)''',
                       ( res_id,
                         log_id,
                         str(resource_link),
                         str(item_title),
                         str(item_content),
                         str(n_date),
                         nd_date,
                         s_date,
                         not_date
                       )
                                    )
        print('Запись новостей успешно произведена!')

UPD:我屏蔽的东西VALUES会保护我的insert吗?

python
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-10-01 19:23:29 +0000 UTC

如何实现日期检查条件?

  • -1

有这个代码:

 goose_date = parser.get_goose_date(resource_link)
                if goose_date is not None:
                # Выполнение методов
                else:
                    print('Гусь не нашел дату.')

也就是这里有这样一个条件,如果goose_date是,none那么什么都不会发生。如何实现这个条件来检查未来的日期。

成为这样的人。

if goose_date and future_date is not None:

即如果有这样的情况,它goose_date需要一个未来的日期,例如10/30/2019 22:51。将使用脚本

                    else:
                        print('Гусь не нашел дату.')

如何实施此类检查的条件?

python
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-09-26 16:39:38 +0000 UTC

如何将变量从一个方法传递给另一个方法?

  • 0

创建了一个类。在这个类中我有方法。

class boilerpipe_parser:

    def __init__(self):
        # < Подключение к базе данных.
        self.connection = pymysql.connect(host = 'localhost',
                             user = 'root',
                             password = '',
                             db = 'news_portal',
                             charset = 'utf8',
                             autocommit = True)
        self.cursor = self.connection.cursor()

    def get_resources(self):
         # < Запрос правил выдергивания из таблицы resource контента.
        self.cursor.execute('SELECT * FROM `resource` where `resource_id` = 76')
        resources = self.cursor.fetchall()
        # < Перебор данных из select запроса.
        for resource in resources:
            res_id = resource[0]
            resource_url = resource[3]
            resource_links = resource[4]
            link_rules = resource[5]
            resource_check = resource[4]

            link_rule = link_rules.split(',')
            return resource_links

    def get_html(self):
        self.r = requests.get()

        return self.r.text

如何将变量作为参数 resource_links传递get_html给方法?变成这样:

def get_html(self, resource_links):
        self.r = requests.get(resource_links)
        return self.r.text

我这样做了:

def get_html(self, resource_links):
        self.r = requests.get(resource_links)
        print(self.r.text)
        return self.r.text

并像这样调用这个方法

# < Вызываю объект класса
parser =boilerpipe_parser()
# < Вызываю метод класса
parser.get_html(resource_links)

结果,错误NameError: name 'resource_links' is not defined是未定义resource_links。如何将变量作为参数从一种方法传递给另一种方法?

python
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-09-25 14:43:53 +0000 UTC

如何将 UNIX 日期添加到数据库?

  • 0

有一个用于请求新闻的数据库。任务是实现在 UNIX 格式的数据库中添加列中出现新闻nd_date的日期和列中数据库本身中添加新闻的日期s_date。 Column DB nd_date.Code:

# < Создаю обьект гуся.
            g = Goose()
            # < С помощью гуся получаю дату.
            goose_date = g.extract(url=item_link).publish_date
            # < Условие если гусь нашел дату.
            if goose_date is not None:
                # < Конвертирую дату.
                date_parsed = dateparser.parse(goose_date)
                not_date = date_parsed.strftime('%Y-%m-%d')
                # < Конвертированную дату  конвертирую в формат UNIX.
                nd_date = int(time.mktime( time.strptime(not_date, '%Y-%m-%d')))
                # Дальше идет insert в БД.

现在我不知道如何在数据库本身的列中实现添加新闻的日期s_date。

python
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-09-24 17:49:54 +0000 UTC

如何解决格式字符串错误的参数不足?[关闭]

  • 0
关闭 这个问题是题外话。目前不接受回复。

该问题是由不再复制的问题或错字引起的。虽然类似的问题可能与本网站相关,但该问题的解决方案不太可能帮助未来的访问者。通常可以通过在发布问题之前编写和研究一个最小程序来重现问题来避免此类问题。

2年前关闭。

改进问题

我正在尝试将数据插入数据库。

sql = "insert into items (`resource_id`,`item_link`,`item_title`,`item_datetime`,`item_text_content`) values (%s,%s,%s,%s,%s)"
         cursor.execute(sql, (str(resource_id), str(item_link), str(item_title), str(item_datetime), str(item_content)))

出现此错误:

  Traceback (most recent call last):
  File "C:/PycharmProjects/parser_goose_and_boilerpipe.py", line 83, in <module>
    call_all_func(resources)
  File "C:/PycharmProjects/parser_goose_and_boilerpipe.py", line 79, in call_all_func
    cursor.execute(sql, (str(resource_id), (str(item_link), str(item_title), str(item_datetime), str(item_content))))
  File "C:AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymysql\cursors.py", line 168, in execute
    query = self.mogrify(query, args)
  File "AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymysql\cursors.py", line 147, in mogrify
    query = query % self._escape_args(args, conn)
TypeError: not enough arguments for format string

Process finished with exit code 1

后来我更正了代码从而改变了values

sql = "insert into items (`resource_id`,`item_link`,`item_title`,`item_datetime`,`item_text_content`) values (%s,%s)"
                   cursor.execute(sql, (str(resource_id), str(item_link), str(item_title), str(item_datetime), str(item_content)))

现在错误是:

Traceback (most recent call last):
  File "C:PycharmProjects/parser_russian_resource/parser_goose_and_boilerpipe.py", line 83, in <module>
    call_all_func(resources)
  File "C:PycharmProjects/parser_russian_resource/parser_goose_and_boilerpipe.py", line 79, in call_all_func
    cursor.execute(sql, (str(resource_id), (str(item_link), str(item_title), str(item_datetime), str(item_content))))
  File "C:AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymysql\cursors.py", line 170, in execute
    result = self._query(query)
  File "C:AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymysql\cursors.py", line 328, in _query
    conn.query(q)
  File "C:AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymysql\connections.py", line 517, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "C:AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymysql\connections.py", line 732, in _read_query_result
    result.read()
  File "C:AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymysql\connections.py", line 1075, in read
    first_packet = self.connection._read_packet()
  File "C:AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymysql\connections.py", line 684, in _read_packet
    packet.check_error()
  File "C:AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymysql\protocol.py", line 220, in check_error
    err.raise_mysql_exception(self._data)
  File "C:AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymysql\err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.InternalError: (1136, "Column count doesn't match value count at row 1")

Process finished with exit code 1

这个错误已经告诉我列数与行中的值不匹配。由于我values只有两个%s %s 值,是否可能出现此错误?传入values超过2个值再次出现同样的错误TypeError: not enough arguments for format string

python
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-09-21 15:35:06 +0000 UTC

我不明白为什么条件不起作用?

  • 0

我使用 feedparser 库解析该资源的 RSS 提要,然后将结果写入数据库。我收到此错误:

Traceback (most recent call last):
  File "C:\Users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\feedparser.py", line 398, in __getattr__
    return self.__getitem__(key)
  File "C:\Users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\feedparser.py", line 356, in __getitem__
    return dict.__getitem__(self, key)
KeyError: 'published'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users=PycharmProjects/parser_russian_resource/parser_rss.py", line 61, in <module>
    call_all_func(resources)
  File "C:/UsersPycharmProjects/parser_russian_resource/parser_rss.py", line 40, in call_all_func
    rss_published = feed.published
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\feedparser.py", line 400, in __getattr__
    raise AttributeError("object has no attribute '%s'" % key)
AttributeError: object has no attribute 'published'

我明白这个错误是什么意思。这意味着我使用了错误的密钥。结果,代码崩溃了。为了一切顺利,我决定提出一个条件。

也就是说,如果发布的密钥不匹配,则使用更新的密钥,如果更新的密钥不匹配,则使用 pubdate 密钥。为此,我编写了以下代码:

rss_published = feed.published

            if rss_published != feed.published:
                rss_published = feed.updated
            else:
                rss_published = feed.pubdate

在这里我无法理解。为什么条件不起作用?

python
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-09-18 13:57:44 +0000 UTC

将日期插入数据库

  • 0

我正在尝试将 RSS 抓取的结果添加到我数据库中的表中。当我尝试将日期插入表格时出现此错误:

pymysql.err.InternalError:(1292,“第 1 行的列 'item_datetime' 的日期时间值不正确:'2019-09-18 05:21:18+00:00'”)

实际上,这是我要插入的表格列的屏幕截图 在此处输入图像描述

下面是负责插入数据的代码部分:

 sql = "insert into items (`item_link`,`item_title`,`item_datetime`, `item_text_content`) values (%s,%s,%s,%s)"
            cursor.execute(sql,(str(resource_link), str(rss_title), str(rss_datetime), str(rss_description)))

rss_datetime日期是以这种格式存储的,2019-09-18 05:21:18+00:00会不会因为日期包含额外的字符而出错"+00:00" ?

python
  • 2 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-09-12 17:11:48 +0000 UTC

我怎样才能使我的例子工作?

  • -1

为python 3.7安装了boilerpipe库

为了测试,我决定检查这样一个简单的例子:

 from boilerpipe.extract import Extractor
 extractor = Extractor(extractor='ArticleExtractor', convertStrings=False ,url="http://en.wikipedia.org/wiki/Main_Page")
 print(extractor.getText())

当我运行代码时,我收到此错误:

C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\jpype\_core.py:210: UserWarning: 
-------------------------------------------------------------------------------
Deprecated: convertStrings was not specified when starting the JVM. The default
behavior in JPype will be False starting in JPype 0.8. The recommended setting
for new code is convertStrings=False.  The legacy value of True was assumed for
this session. If you are a user of an application that reported this warning,
please file a ticket with the developer.
-------------------------------------------------------------------------------

  """)

Process finished with exit code -1073740791 (0xC0000409)

如何解决这个错误?

python
  • 1 个回答
  • 10 Views
Martin Hope
Raharasomaha
Asked: 2020-09-09 14:05:01 +0000 UTC

Request.exceptions.InvalidSchema:找不到连接适配器?

  • 1

我欢迎大家!我正在从这个资源中解析日期。这是日期在此处输入图像描述

有这样一段代码:

# < Получаем ссылки и дату с главной страницы где берутся ссылки.
def get_resource_links(resource_page, datetimes_main_rule, links_rule, resource_domain):
    resource_links = []
    soup = BeautifulSoup(resource_page,'lxml')
    resource_links_blocks = soup.find_all(links_rule[0], {links_rule[1]: links_rule[2]})
    main_page_datetime = soup.find(datetimes_main_rule[0], {datetimes_main_rule[1]: datetimes_main_rule[2]})
    if (len(datetimes_main_rule) == 3):
        main_page_datetime = soup.find(datetimes_main_rule[0], {datetimes_main_rule[1]: datetimes_main_rule[2]})
    for resource_link_block in resource_links_blocks:
        a_tag = resource_link_block .find("a")
        if a_tag:
            link = a_tag.get("href")
            resource_links.append(resource_domain + link)
    return (resource_links, main_page_datetime)

在这段代码中,我正在解析日期:

main_page_datetime = soup.find(datetimes_main_rule[0], {datetimes_main_rule[1]: datetimes_main_rule[2]})
    if (len(datetimes_main_rule) == 3):
        main_page_datetime = soup.find(datetimes_main_rule[0], {datetimes_main_rule[1]: datetimes_main_rule[2]})

当我运行代码时,我收到此错误:

Traceback (most recent call last):
  File "C:/Users/Администратор/PycharmProjects/Task/parser.py", line 142, in <module>
    call_all_func(resources)
  File "C:/Users/Администратор/PycharmProjects/Task/parser.py", line 123, in call_all_func
    item_page = get_html(resource_link, encodings_rule)
  File "C:/Users/Администратор/PycharmProjects/Task/parser.py", line 16, in get_html
    r = requests.get(url)
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 640, in send
    adapter = self.get_adapter(url=request.url)
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 731, in get_adapter
    raise InvalidSchema("No connection adapters were found for '%s'" % url)
requests.exceptions.InvalidSchema: No connection adapters were found for '['https://kapital.kz/finance/81046/nacvalyuta-k-dollaru-ukrepilas-na-1-2-tenge.html', 'https://kapital.kz/real_estate/81045/baspana-hit-kazahstancy-kupili-svyshe-13-tysyach-kvartir.html', 'https://kapital.kz/finance/81044/obem-potrebitelskih-kreditov-dostig-3-8-trln-tenge.html', 'https://kapital.kz/economic/80977/ayan-erenov-eksportnaya-orientirovannost-v-strany-ca-daet-rezultaty.html', 'https://kapital.kz/business/80961/kak-razvivaet-biznes-edinstvennyj-proizvoditel-bytovoj-himii-zko.html', 'https://kapital.kz/gosudarstvo/80974/ao-i-too-osobennosti-deyatelnosti-i-regulirovaniya.html', 'https://kapital.kz/business/80954/kazahstanec-vyvel-na-rynok-innovacionnyj-gel.html', 'https://kapital.kz/gosudarstvo/81043/sotrudnichestvo-s-oae-i-rossiej-rejting-kazahstana-podderzhka-proizvoditelej.html', 'https://kapital.kz/tehnology/81042/v-moody-s-predskazali-standartizaciyu-tehnologii-blokchejn.html', 'https://kapital.kz/world/81041/torgovlya-kitaya-i-ssha-sokratilas-na-14.html', 'https://kapital.kz/economic/81040/kak-otlichayutsya-ceny-na-bilety-v-kino-v-kazahstane-i-mire.html', 'https://kapital.kz/world/81039/palata-lordov-utverdila-proekt-o-perenose-brexit.html', 'https://kapital.kz/finance/81038/mfo-operezhayut-banki-po-tempam-rosta-kreditovaniya.html', 'https://kapital.kz/world/81037/telegram-razreshil-polzovatelyam-skryvat-nomer-telefona.html', 'https://kapital.kz/gosudarstvo/81036/chto-bolshe-vsego-chitali-na-etoj-nedele-na-kapital-kz.html']'

Process finished with exit code 1

根据回溯,错误在于这部分代码:

def get_html(url, encodings_rule):
    try:
        r = requests.get(url)
        if (len(encodings_rule) == 1):
            r.encoding = encodings_rule[0]
            return r.text
    except TooManyRedirects as e:
        print(f'{url} : {e}')
python
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5