fact = random.choice(html.find_all('h2', class_='entry-title'))
MySQLite is an easy way to add MySQL functions to SQLite accessed through PDO.
Подскажите пожалуйста как можно решить проблему.
/usr/local/
). $ python3
Python 3.10.2 (main, Mar 8 2022, 23:56:15) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> '123'.isdigit()
True
>>> '123+'.isdigit()
False
>>> '123a'.isdigit()
False
Хочу по приколу сделать бота в телеграмме
Я в питоне очень плохо понимаю
title = post.find("a", class_="post__title_link").text.strip()
post__title_link
, то post.find("a", class_="post__title_link")
принимает значение None
. Отсюда ошибка AttributeError: 'NoneType' object has no attribute 'text'
. import numpy as np
import pandas as pd
df = pd.DataFrame([[np.nan, 'f+2', np.nan, '0'],
['3', '4', np.nan, 'y1,et'],
[np.nan, np.nan, np.nan, np.nan],
[np.nan, '3', np.nan, 'w$4q']],
columns=list("ABCD"))
print(df)
df.replace(to_replace=r'[a-zA-Z+$,]', value='', inplace=True, regex=True)
print(df)
df = df.fillna(0.0)
df = df.astype(float)
print(df)
A B C D
0 NaN f+2 NaN 0
1 3 4 NaN y1,et
2 NaN NaN NaN NaN
3 NaN 3 NaN w$4q
A B C D
0 NaN 2 NaN 0
1 3 4 NaN 1
2 NaN NaN NaN NaN
3 NaN 3 NaN 4
A B C D
0 0.0 2.0 0.0 0.0
1 3.0 4.0 0.0 1.0
2 0.0 0.0 0.0 0.0
3 0.0 3.0 0.0 4.0
Как запустить код на библиотеке selenium_stealth без монитора?
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium_stealth import stealth
import time
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
options.add_argument("--headless")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(options=options)
stealth(driver,
languages=["en-US", "en"],
vendor="Google Inc.",
platform="Win32",
webgl_vendor="Intel Inc.",
renderer="Intel Iris OpenGL Engine",
fix_hairline=True,
)
url = "https://bot.sannysoft.com/"
driver.get(url)
time.sleep(5)
driver.quit()