def main():
list_from_line = []
with open("input.txt") as f:
for line in f:
list_from_line += line.lower().strip().split()
unique_keys = set(list_from_line)
top = {
key: list_from_line.count(key) for key in unique_keys
}
max_count = max(top.values())
top_items = [item for item in top.items() if item[1] == max_count]
result = min(top_items, key = lambda x: x[0])
print(f"{result[0]} {result[1]}")
if __name__ == "__main__":
main()
abc 3
u 11
from tqdm import tqdm
with open("test.txt") as file:
num_lines = sum(1 for line in file)
file.seek(0)
with tqdm(total = num_lines) as pbar:
for line in file:
a = str.strip(line)
h = func_1(a)
func_2(a, h)
pbar.update(1)
@bot.message_handler(commands=['start'])
def start(message):
print(bot.send_message(message.chat.id, "tess").message_id)
def main(email, password):
pop = POP3_SSL("pop.yandex.by")
pop.user(email)
pop.pass_(password)
response, lst, octets = pop.list()
print(response, lst, octets)
for msgnum, msgsize in [i.split() for i in lst]:
(resp, lines, octets) = pop.retr(int(msgnum))
msgtext = "n".join(lines) + "nn"#Нужно отлаживать, тут бред происходит
message = email.message_from_string(msgtext)# тут тоже
print(message)
pop.dele(int(msgnum))
pop.quit()
def f_readlist():
with open('flats_list') as file_flats:
consetsen = file_flats
s = list()# s список
for s in consetsen:#s строка
s = s.split()# s список
return s
print(f_readlist())
import requests
import time
from bs4 import BeautifulSoup as BS
phone = input("phone: ")
num_name = []
phone_ow = requests.get(f'https://phonebook.space/?input={phone}', cookies={"__atuvs":""}).text
content = BS(phone_ow, 'html.parser').find('div', class_='results')
for i in content.find_all('li'):
num_name.append(i.text.strip())
name = ', '.join(num_name)
print(name)
class Wall(pygame.sprite.Sprite):
def init(self):
pygame.sprite.Sprite.__init__(self)
self.fill(BLACK)
self.rect = self.image.get_rect()
self.rect.center = (WIDTH / 2, HEIGHT / 2)
def create(self,colour,x,y):
self.image.fill(colour) #Тута
self.rect.y = y
self.rect.x = x
self.rect.width = 10
self.rect.height = 10
Wall.create("",GREEN,0,0)
import telebot
import config
bot = telebot.TeleBot(config.TOKEN)
@bot.message_handler(commands=["start"])
def welcome(message):
sti = open("static/welcome.webp", "rb")
bot.send_sticker(message.chat.id, sti)
bot.send_message(message.chat.id , "Добро пожаловать, {0.first_name}!\nЯ - {1.first_name}, бот созданный чтобы быть подопытным кроликом.".format(message.from_user, bot.get_me()),
parse_mode="html")
@bot.message_handler(content_types=["text"])
def lalala(message):
bot.send_message(message.chat.id, message.text)
#RUN
bot.polling(none_stop=True)
from os import listdir # отдаёт в виде масива содержание директории которая передана первым и единственным аргументов
from os.path import isdir # Проверяет является ли ли строка директрией, нужен из-за того, что можно создать папку test.exe, по идее файл, но на самом деле папка.
Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from operator import lt
>>> help(lt)
Help on built-in function lt in module _operator:
lt(...)
lt(a, b) -- Same as a<b.
>>>