Если вы хотите итерироваться одновременно по нескольким итерируемым объектам, функция zip может быть хорошим выбором. Она возвращает генератор, который выдаёт кортежи, содержащие по одному элементу из каждого исходного итерируемого объекта:
In : eng = ['one', 'two', 'three'] In : ger = ['eins', 'zwei', 'drei'] In : for e, g in zip(eng, ger): ...: print('{e} = {g}'.format(e=e, g=g)) ...:
Вывод:
one = eins two = zwei three = drei
Обратите внимание, что zip принимает итерируемые объекты как отдельные аргументы, а не в виде списка аргументов. Чтобы «развернуть» значения (unzip), можно использовать оператор *:
Если вы хотите итерироваться одновременно по нескольким итерируемым объектам, функция zip может быть хорошим выбором. Она возвращает генератор, который выдаёт кортежи, содержащие по одному элементу из каждого исходного итерируемого объекта:
In : eng = ['one', 'two', 'three'] In : ger = ['eins', 'zwei', 'drei'] In : for e, g in zip(eng, ger): ...: print('{e} = {g}'.format(e=e, g=g)) ...:
Вывод:
one = eins two = zwei three = drei
Обратите внимание, что zip принимает итерируемые объекты как отдельные аргументы, а не в виде списка аргументов. Чтобы «развернуть» значения (unzip), можно использовать оператор *:
It’s yet another bloodbath on Satoshi Street. As of press time, Bitcoin (BTC) and the broader cryptocurrency market have corrected another 10 percent amid a massive sell-off. Ethereum (EHT) is down a staggering 15 percent moving close to $1,000, down more than 42 percent on the weekly chart. A Telegram channel is used for various purposes, from sharing helpful content to implementing a business strategy. In addition, you can use your channel to build and improve your company image, boost your sales, make profits, enhance customer loyalty, and more. While the character limit is 255, try to fit into 200 characters. This way, users will be able to take in your text fast and efficiently. Reveal the essence of your channel and provide contact information. For example, you can add a bot name, link to your pricing plans, etc. Activate up to 20 bots To view your bio, click the Menu icon and select “View channel info.”
from us