namespace='shop'
f1 = open("D:/text1.txt", 'w')
s = 'elif call.data == "f{0}": \n \
FILTER[user_id] = \'{1}\' \n \
msg = bot.send_message(call.message.chat.id, "Выбран стиль {0}.") \n \
bot.register_next_step_handler(msg, load) \n \
bot.edit_message_reply_markup(call.message.chat.id, call.message.message_id, reply_markup = None) \n \
'
with open('D:/text1.txt', 'a') as f:
for i, value in enumerate(list[1:]):
f.write(s.format(i, value))
api.photos.getById(str(id))
import requests
import urllib.parse
word = urllib.parse.quote_plus(input('Введите слово для поиска синонимов: ').encode('cp1251'))
url = 'http://trishin.net/'
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36',
'Referer': 'http://trishin.net/',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'Content-Type': 'application/x-www-form-urlencoded'}
s = requests.Session()
s.get('http://trishin.net')
payload = 'mode=leftPart&searchText={}&left=456511&right=2726'.format(word)
response = s.post(url, data=payload, headers=headers)
print(response.text)
import feedparser
import time
upwork_rss_url = 'https://www.upwork.com/ab/feed/jobs/rss?sort=recency&user_location_match=1&paging=0%3B10&api_params=1&q=&securityToken=6da89e82d7da8ae885411b27044affdc3a71a8f6b7bd5867c9b62e1c7f0ce3cb7ba1097847ae92d8a180517cfb5636ced80f02cd6ca5d0327e553c48dd37da38&userUid=646985892418633728&orgUid=646985892422828033'
jobs = []
while True:
feeds = feedparser.parse(upwork_rss_url)
for job in feeds.entries:
title = job['title']
if title not in jobs:
print('New job found\n', title)
jobs.append(title)
time.sleep(600)
i
. Она пробежала весь цикл и вернулась.for i in range(len(mas)):
if mas[i] < max_ar:
max_ar = mas[i]
return i
def f_maxIndex(mas):
max_index = 0
max_ar = mas[0]
for i in range(len(mas)):
if mas[i] > max_ar:
max_ar = mas[i]
max_index = i
return max_index
def f_minIndex(mas):
min_index = 0
min_ar = mas[0]
for i in range(len(mas)):
if mas[i] < min_ar:
min_ar = mas[i]
min_index = i
return min_index
import requests
import base64
with open("nums.jpeg", "rb") as image_file:
image_hash = base64.b64encode(image_file.read()).decode("utf-8")
encoded_image = 'data:image/jpeg;base64,{}'.format(image_hash)
payload = {'fileToUpload': encoded_image}
r = requests.post('http://color.photofuneditor.com/ceremony-vegas', data=payload)
if r.status_code == 200:
image_url = 'http://color.photofuneditor.com/output/{}'.format(r.json()['file_link'])
r = requests.get(image_url)
with open('new_image.jpg', 'wb') as f:
f.write(r.content)