#!/bin/bash
FILES="/root/temp/*"
#echo $FILES
for file in $FILES
do
if [ "${file: -4}" == ".zip" ]; then
echo "some string with name of $file"
fi
done
from pprint import pprint
cards = {'card_' + str(x): {'name': x, 'desc': x, 'photo': x} for x in range(1,22)}
cards['card_21']['name'] = 'Мир'
cards['card_21']['desc'] = 'Завершенность бла бла бла'
cards['card_21']['photo'] = 'C:/Tools/tmp/card_21.png'
pprint(cards)
{'card_1': {'desc': 1, 'name': 1, 'photo': 1},
'card_10': {'desc': 10, 'name': 10, 'photo': 10},
'card_11': {'desc': 11, 'name': 11, 'photo': 11},
'card_12': {'desc': 12, 'name': 12, 'photo': 12},
'card_13': {'desc': 13, 'name': 13, 'photo': 13},
'card_14': {'desc': 14, 'name': 14, 'photo': 14},
'card_15': {'desc': 15, 'name': 15, 'photo': 15},
'card_16': {'desc': 16, 'name': 16, 'photo': 16},
'card_17': {'desc': 17, 'name': 17, 'photo': 17},
'card_18': {'desc': 18, 'name': 18, 'photo': 18},
'card_19': {'desc': 19, 'name': 19, 'photo': 19},
'card_2': {'desc': 2, 'name': 2, 'photo': 2},
'card_20': {'desc': 20, 'name': 20, 'photo': 20},
'card_21': {'desc': 'Завершенность бла бла бла',
'name': 'Мир',
'photo': 'C:/Tools/tmp/card_21.png'},
'card_3': {'desc': 3, 'name': 3, 'photo': 3},
'card_4': {'desc': 4, 'name': 4, 'photo': 4},
'card_5': {'desc': 5, 'name': 5, 'photo': 5},
'card_6': {'desc': 6, 'name': 6, 'photo': 6},
'card_7': {'desc': 7, 'name': 7, 'photo': 7},
'card_8': {'desc': 8, 'name': 8, 'photo': 8},
'card_9': {'desc': 9, 'name': 9, 'photo': 9}}
with open(cards['card_21']['photo'], "rb") as file:
data = file.read()
bot.send_photo(message.from_user.id, photo=data)
import requests
from bs4 import BeautifulSoup as BS
zodiacs = {
"Овен": {"unicode": 9800, "latin": "Aries"},
"Телец": {"unicode": 9801, "latin": "Taurus"},
"Близнецы": {"unicode": 9802, "latin": "Gemini"},
"Рак": {"unicode": 9803, "latin": "Cancer"},
"Лев": {"unicode": 9804, "latin": "Leo"},
"Дева": {"unicode": 9805, "latin": "Virgo"},
"Весы": {"unicode": 9806, "latin": "Libra"},
"Скорпион": {"unicode": 9807, "latin": "Scorpio"},
"Змееносец": {"unicode": 9934, "latin": "Ophiuchus"},
"Стрелец": {"unicode": 9808, "latin": "Sagittarius"},
"Козерог": {"unicode": 9809, "latin": "Capricon"},
"Водолей": {"unicode": 9810, "latin": "Aquarius"},
"Рыбы": {"unicode": 9811, "latin": "Pisces"}
}
def get_horoscope(zodiac, URL='https://horoscopes.rambler.ru'):
ASKURL = f'{URL}/{zodiac.lower()}/'
HEADERS = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.0; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0'}
response = requests.get(ASKURL, headers=HEADERS)
soup = BS(response.content, 'html.parser')
item = soup.findAll('div', class_='_1E4Zo _3BLIa')[0]
parse_result = item.find('p', class_='mtZOt').get_text(strip=True)
return parse_result
def get_info(zodiac):
ask_horo = zodiacs[zodiac].get('latin')
uni_horo = chr(zodiacs[zodiac].get('unicode'))
result_horo = get_horoscope(ask_horo)
return f'Результаты для знака зодиака {zodiac}- {ask_horo} - {uni_horo}\n{result_horo}'
my_horo = get_info('Дева')
print(my_horo)
data_svz = pd.DataFrame({'Бренд':[brand],'Модель':[model],'Описание':[description],'цена':[prise],'старя цена':[old_prise],'дата обновления':[date]})
id, brand, model, description, prise, old_prise, date = values
data = {'Бренд':[brand],'Модель':[model],'Описание':[description],'цена':[prise],'старя цена':[old_prise],'дата обновления':[date]}
data_svz = data_svz.append(data , ignore_index=True)
>>> import time
>>> time.time()
1620233838.275895
>>> current_time = int(time.time())
>>> current_time
1620233873
>>> expire_date = current_time + 7 * 24 * 60 * 60
# прибавили число равное 7 суткам в секундах
>>> expire_date
1620838673
# время жизни = текущее время + 7дней
import tkinter as tk
root = tk.Tk()
def myfunction(*args):
l = 6
check_entry = stringvar1.get()
if len(check_entry) >= l:
button.config(state='normal')
else:
button.config(state='disabled')
stringvar1 = tk.StringVar(root)
stringvar1.trace("w", myfunction)
entry1 = tk.Entry(root, width=15, textvariable=stringvar1)
entry1.grid(row=1,column=1)
button = tk.Button(root,text="submit", state='disabled')
button.grid(row=1, column=4)
root.mainloop()