def test_connect(domain: str, port: int):
try:
with socket.create_connection((domain, port)) as s:
return True
except OSError:
pass
return False
a_dict = {'color': 'blue', 'fruit': 'apple', 'pet': 'dog'}
for key in a_dict:
print(key)
if a_dict['color'] == 'blue':
a_dict['color'] = 'white'
next_post = cli.iter_messages(
entity,
limit=5,
min_id=your_post_id,
reverse=True
)
from aiogram.types import URLInputFile
image = URLInputFile(
"https://www.python.org/static/community_logos/python-powered-h-140x182.png",
filename="python-logo.png"
)
await bot.send_photo(message.chat.id, image )
from distutils.dir_util import copy_tree
from_directory = "/a/b/c"
to_directory = "/x/y/z"
copy_tree(from_directory, to_directory)
import shutil
# копирование файла
shutil.copy(src, dst)
# перемещение
shutil.move(src, dst)