def printer(msg="hello", times=5):
for i in range(times):
print(msg)
# или любая другая реализация
printer()
printer("example", 10)
import dryscrape
import sys
if 'linux' in sys.platform:
dryscrape.start_xvfb()
sess = dryscrape.Session(base_url = 'http://arhivach.org/thread/')
sess.set_attribute('auto_load_images', False)
# Thread 1234
sess.visit('1234/')
for reply in sess.xpath('//span[@class="post_replies"]'):
do_stuff()
# Screenshot
sess.render('screenshot.png')
if big_expression and another_big_expressions or ... :
do_stuff()
else:
do_another_stuff()
def foo(bar, buzz):
...
return bar if expression else buzz
def send_many(photos, id):
for p in photos:
bot.send_photo(id, p)
bot.send_message(id, '<a href="IMG_URL">​</a>',
parse_mode="HTML")