def all_args_is_none(args_list: list) -> bool:
return all(True if _ is None else False for _ in args_list)
def main():
if args.csv2parquet is not None:
csv_to_parquet(args.csv2parquet[0], args.csv2parquet[1])
if args.parquet2csv is not None:
parquet_to_csv(args.parquet2csv[0], args.parquet2csv[1])
if args.get_schema is not None:
print(get_schema(args.get_schema))
if all_args_is_none(args_list=[args.csv2parquet, args.parquet2csv, args.get_schema]):
print('type: python3 convert.py --help')
from telethon.sync import TelegramClient
from telethon import functions, types
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.account.UpdateStatusRequest(
offline=False
))
print(result)
table = driver.find_element_by_xpath('//div[@class="table"]')
rows = table.find_elements_by_xpath('//div')
for row in rows:
print(row.text())
rows = driver.find_element_by_xpath('//div[@class="table"]//div')
for row in rows:
print(row.text())
items = node.find_elements_by_xpath('xpath')
for item in items:
print(item.get_attribute('href'))
[getattr(root, attr)(value) for attr, value in [('title', 'Title'), ('geometry', '300x250') ]]
api = QApi(token=token, phone=phone)
comment = api.bill(price=100, comment=user_id)
//span[text()='Российский рубль']/preceding-sibling::span
import requests
from fake_useragent import UserAgent
from lxml import etree
url = "https://www.google.com/search?q=%D0%B4%D0%BE%D0%BB%D0%BB%D0%B0%D1%80&oq=" \
"%D0%B4%D0%BE%D0%BB%D0%BB%D0%B0%D1%80&aqs=chrome.0.69i59j0i67i131i433j0i6" \
"7i433j0i67j0i67i433j46i433i512j0i67j0i433i512l2j0i512.6063j0j1&sourceid=chrome&ie=UTF-8"
gd = UserAgent().chrome
response = requests.get(url, headers={'User-Agent': gd})
htmlparser = etree.HTMLParser()
tree = etree.fromstring(response.text, htmlparser)
result = tree.xpath("//div[contains(text(),'Российский рубль')]")
price = result[0].text.split()[0]
print(f'Стоимость доллара: {price} руб.')
Стоимость доллара: 72,75
Process finished with exit code 0
SELECT string_agg(unnest, '') FROM(
select * FROM (select unnest(string_to_array(string_agg(concat(
substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil(random() * 26)::integer, 1),
substring('abcdefghijklmnopqrstuvwxyz', ceil(random() * 26)::integer, 1),
substring('0123456789', ceil(random() * 10)::integer, 1),
substring('!#$%&()*+,-./:;<=>?@[]^', ceil(random() * 23)::integer, 1)
), ''), NULL)) FROM generate_series(1,8)) x ORDER BY RANDOM()) as random_chars
def users_in_db(message):
with sqlite3.connect(db) as conn:
with conn.cursor() as cursor:
sql_users_in_db = """SELECT chat_id FROM users WHERE chat_id = ?;"""
cursor.execute(sql_users_in_db, message.chat.id)
users = cursor.fetchall()
print(users)
if users:
return True
return False
@dp.message_handler(commands=["users"])
async def process_start_command(message: Message):
if users_in_db(message):
print("зареган")
else:
print("не зареган")