Python Flatten List: практическое руководство

–°–≥–ª–∞–∂–∏–≤–∞–Ω–∏–µ —Å–ø–∏—Å–∫–∞ - —ç—Ç–æ –ø—Ä–æ—Ü–µ—Å—Å —É–¥–∞–ª–µ–Ω–∏—è –∏–∑–º–µ—Ä–µ–Ω–∏—è –∏–∑ —Å–ø–∏—Å–∫–∞. –†–∞–∑–º–µ—Ä - —ç—Ç–æ –¥–æ–ø–æ–ª–Ω–∏—Ç–µ–ª—å–Ω–∞—è –∫–æ–æ—Ä–¥–∏–Ω–∞—Ç–∞, –Ω–µ–æ–±—Ö–æ–¥–∏–º–∞—è –¥–ª—è –Ω–∞—Ö–æ–∂–¥–µ–Ω–∏—è —ç–ª–µ–º–µ–Ω—Ç–∞ –≤ —Å–ø–∏—Å–∫–µ. –í—ã –º–æ–∂–µ—Ç–µ —Å–≥–ª–∞–¥–∏—Ç—å —Å–ø–∏—Å–æ–∫ Python, –∏—Å–ø–æ–ª—å–∑—É—è –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ø–∏—Å–∫–∞, –≤–ª–æ–∂–µ–Ω–Ω—ã–π —Ü–∏–∫–ª for –∏–ª–∏ –º–µ—Ç–æ–¥ itertools.chain ().

–°–ø–∏—Å–æ–∫ Python –º–æ–∂–µ—Ç —Å–æ–¥–µ—Ä–∂–∞—Ç—å –Ω–µ—Å–∫–æ–ª—å–∫–æ –∏–∑–º–µ—Ä–µ–Ω–∏–π. –≠—Ç–æ –æ–∑–Ω–∞—á–∞–µ—Ç, —á—Ç–æ —É –≤–∞—Å –µ—Å—Ç—å —Å–ø–∏—Å–æ–∫ –≤–Ω—É—Ç—Ä–∏ —Å–ø–∏—Å–∫–æ–≤. –≠—Ç–∏ —Å–ø–∏—Å–∫–∏, –∏–Ω–æ–≥–¥–∞ –Ω–∞–∑—ã–≤–∞–µ–º—ã–µ " –≤–ª–æ–∂–µ–Ω–Ω—ã–º–∏ —Å–ø–∏—Å–∫–∞–º–∏ " –º–æ–∂–Ω–æ –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞—Ç—å –æ–±—Ä–∞—Ç–Ω–æ –≤ –æ–±—ã—á–Ω—ã–π —Å–ø–∏—Å–æ–∫.

–≠—Ç–æ –æ–∑–Ω–∞—á–∞–µ—Ç, —á—Ç–æ –≤—ã –º–æ–∂–µ—Ç–µ –ø–µ—Ä–µ–º–µ—Å—Ç–∏—Ç—å –≤—Å–µ –∑–Ω–∞—á–µ–Ω–∏—è –∏–∑ —Å–ø–∏—Å–∫–æ–≤ –≤ —Å–ø–∏—Å–∫–µ –≤ –æ–¥–∏–Ω —Å–ø–∏—Å–æ–∫. –ü—Ä–µ–≤—Ä–∞—â–µ–Ω–∏–µ —Å–ø–∏—Å–∫–∞ —Å–ø–∏—Å–∫–æ–≤ –≤ —Å–ø–∏—Å–æ–∫ –Ω–∞–∑—ã–≤–∞–µ—Ç—Å—è " —Å–≥–ª–∞–∂–∏–≤–∞–Ω–∏–µ–º —Å–ø–∏—Å–∫–∞ "

Python Flatten List

–ï—Å—Ç—å —Ç—Ä–∏ —Å–ø–æ—Å–æ–±–∞ —Å–≥–ª–∞–¥–∏—Ç—å —Å–ø–∏—Å–æ–∫ Python:

  • –ò—Å–ø–æ–ª—å–∑–æ–≤–∞–Ω–∏–µ –ø–æ–Ω–∏–º–∞–Ω–∏—è —Å–ø–∏—Å–∫–∞.
  • –ò—Å–ø–æ–ª—å–∑–æ–≤–∞–Ω–∏–µ –≤–ª–æ–∂–µ–Ω–Ω–æ–≥–æ —Ü–∏–∫–ª–∞ for.
  • –ò—Å–ø–æ–ª—å–∑–æ–≤–∞–Ω–∏–µ –º–µ—Ç–æ–¥–∞ itertools.chain ().

–í —ç—Ç–æ–º —Ä—É–∫–æ–≤–æ–¥—Å—Ç–≤–µ –º—ã –≥–æ–≤–æ—Ä–∏–º –æ —Ç–æ–º, –∫–∞–∫ —Å–≥–ª–∞–¥–∏—Ç—å —Å–ø–∏—Å–æ–∫, –∏—Å–ø–æ–ª—å–∑—É—è –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ø–∏—Å–∫–∞, —Ü–∏–∫–ª for –∏ –º–µ—Ç–æ–¥ itertools.chain (). –ú—ã —Ä–∞—Å—Å–º–æ—Ç—Ä–∏–º –¥–≤–∞ –ø—Ä–∏–º–µ—Ä–∞, —á—Ç–æ–±—ã –≤—ã –º–æ–≥–ª–∏ –Ω–∞—á–∞—Ç—å —Å–≥–ª–∞–∂–∏–≤–∞–Ω–∏–µ —Å–ø–∏—Å–∫–æ–≤ –≤ —Å–≤–æ–∏—Ö —Å–æ–±—Å—Ç–≤–µ–Ω–Ω—ã—Ö –ø—Ä–æ–≥—Ä–∞–º–º–∞—Ö.

Python: —Å–≥–ª–∞–∂–∏–≤–∞–Ω–∏–µ —Å–ø–∏—Å–∫–æ–≤ —Å –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–Ω–∏–µ–º –ø–æ–Ω–∏–º–∞–Ω–∏—è —Å–ø–∏—Å–∫–∞

A Python list computing –æ–ø—Ä–µ–¥–µ–ª—è–µ—Ç —Å–ø–∏—Å–æ–∫ –Ω–∞ –æ—Å–Ω–æ–≤–µ —Å–æ–¥–µ—Ä–∂–∏–º–æ–≥–æ —Å—É—â–µ—Å—Ç–≤—É—é—â–µ–≥–æ —Å–ø–∏—Å–∫–∞. –í—ã –º–æ–∂–µ—Ç–µ –Ω–∞—Å—Ç—Ä–æ–∏—Ç—å –∫–∞–∂–¥—ã–π —ç–ª–µ–º–µ–Ω—Ç, –∫–æ—Ç–æ—Ä—ã–π –≤—Ö–æ–¥–∏—Ç –≤ –≤–∞—à –Ω–æ–≤—ã–π —Å–ø–∏—Å–æ–∫, —É–∫–∞–∑–∞–≤ —É—Å–ª–æ–≤–∏—è –∏–ª–∏ –∏–∑–º–µ–Ω–µ–Ω–∏—è –≤ –ø–æ–Ω–∏–º–∞–Ω–∏–∏.

–ö–æ–º–ø–æ–Ω–µ–Ω—Ç—ã - —ç—Ç–æ —Å–∏–Ω—Ç–∞–∫—Å–∏—á–µ—Å–∫–∏–π —Å–∞—Ö–∞—Ä –¥–ª—è –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–Ω–∏—è —Ü–∏–∫–ª–∞ for –¥–ª—è –ø–µ—Ä–µ–±–æ—Ä–∞ —Å–ø–∏—Å–∫–∞ –∏ —Å–æ–∑–¥–∞–Ω–∏—è –Ω–æ–≤–æ–≥–æ —Å–ø–∏—Å–∫–∞. –≠—Ç–æ –æ–∑–Ω–∞—á–∞–µ—Ç, —á—Ç–æ –æ–Ω–∏ —Ä–∞–±–æ—Ç–∞—é—Ç —Ç–∞–∫ –∂–µ, –∫–∞–∫ —Ü–∏–∫–ª for, –Ω–æ –∏—Å–ø–æ–ª—å–∑—É—é—Ç –¥—Ä—É–≥–æ–π —Å–∏–Ω—Ç–∞–∫—Å–∏—Å.

–í–æ—Ç —Å–∏–Ω—Ç–∞–∫—Å–∏—Å –¥–ª—è –ø–æ–Ω–∏–º–∞–Ω–∏—è —Å–ø–∏—Å–∫–∞:

81% —É—á–∞—Å—Ç–Ω–∏–∫–æ–≤ –∑–∞—è–≤–∏–ª–∏, —á—Ç–æ —á—É–≤—Å—Ç–≤—É—é—Ç —Å–µ–±—è –±–æ–ª–µ–µ —É–≤–µ—Ä–µ–Ω–Ω–æ –æ–± –∏—Ö –ø–µ—Ä—Å–ø–µ–∫—Ç–∏–≤–∞—Ö —Ç—Ä—É–¥–æ—É—Å—Ç—Ä–æ–π—Å—Ç–≤–∞ –≤ —Å—Ñ–µ—Ä–µ –≤—ã—Å–æ–∫–∏—Ö —Ç–µ—Ö–Ω–æ–ª–æ–≥–∏–π –ø–æ—Å–ª–µ —É—á–∞—Å—Ç–∏—è –≤ –±—É—Ç–∫–µ–º–ø–µ. –ù–∞–π–¥–∏—Ç–µ –ø–æ–¥—Ö–æ–¥ –∫ —É—á–µ–±–Ω–æ–º—É –ª–∞–≥–µ—Ä—é —Å–µ–≥–æ–¥–Ω—è.

–°—Ä–µ–¥–Ω–∏–π –≤—ã–ø—É—Å–∫–Ω–∏–∫ —É—á–µ–±–Ω–æ–≥–æ –ª–∞–≥–µ—Ä—è –ø–æ—Ç—Ä–∞—Ç–∏–ª –º–µ–Ω–µ–µ —à–µ—Å—Ç–∏ –º–µ—Å—è—Ü–µ–≤ –Ω–∞ —Å–º–µ–Ω—É –∫–∞—Ä—å–µ—Ä—ã, –æ—Ç –Ω–∞—á–∞–ª–∞ —É—á–µ–±–Ω–æ–≥–æ –ª–∞–≥–µ—Ä—è –¥–æ –ø–æ–∏—Å–∫–∞ —Å–≤–æ–µ–π –ø–µ—Ä–≤–æ–π —Ä–∞–±–æ—Ç—ã.

–≠—Ç–æ –ø–æ–Ω–∏–º–∞–Ω–∏–µ —É–º–Ω–æ–∂–∞–µ—Ç –∫–∞–∂–¥–æ–µ —á–∏—Å–ª–æ –≤ –Ω–∞—à–∏ " —á–∏—Å–ª–∞ " list by 2.

–°–≥–ª–∞–∂–µ–Ω–Ω—ã–π —Å–ø–∏—Å–æ–∫: –ø—Ä–∏–º–µ—Ä –ø–æ–Ω–∏–º–∞–Ω–∏—è —Å–ø–∏—Å–∫–∞

–£ –Ω–∞—Å –µ—Å—Ç—å —Å–ø–∏—Å–æ–∫ —Å–ø–∏—Å–∫–æ–≤, —Å–æ–¥–µ—Ä–∂–∞—â–∏—Ö —Ä–∞–∑–ª–∏—á–Ω—ã–µ –Ω–∞—á–∏–Ω–∫–∏ –¥–ª—è —Å—ç–Ω–¥–≤–∏—á–µ–π, –¥–æ—Å—Ç—É–ø–Ω—ã–µ –≤ —Ä–µ—Å—Ç–æ—Ä–∞–Ω–µ. –í –Ω–∞—Å—Ç–æ—è—â–µ–µ –≤—Ä–µ–º—è –Ω–∞—à —Å–ø–∏—Å–æ–∫ —Å–ø–∏—Å–∫–æ–≤ –≤—ã–≥–ª—è–¥–∏—Ç —Å–ª–µ–¥—É—é—â–∏–º –æ–±—Ä–∞–∑–æ–º:

–ü–µ—Ä–≤—ã–π —Å–ø–∏—Å–æ–∫ —Å–æ–¥–µ—Ä–∂–∏—Ç –≤–µ–≥–∞–Ω—Å–∫–∏–µ –Ω–∞—á–∏–Ω–∫–∏ –¥–ª—è —Å—ç–Ω–¥–≤–∏—á–µ–π; –≤–æ –≤—Ç–æ—Ä–æ–º —Å–ø–∏—Å–∫–µ - –≤–µ–≥–µ—Ç–∞—Ä–∏–∞–Ω—Å–∫–∏–µ –Ω–∞—á–∏–Ω–∫–∏ –¥–ª—è —Å—ç–Ω–¥–≤–∏—á–µ–π; —Ç—Ä–µ—Ç–∏–π —Å–ø–∏—Å–æ–∫ —Å–æ–¥–µ—Ä–∂–∏—Ç –≤—Å–µ –Ω–∞—á–∏–Ω–∫–∏ –¥–ª—è —Å—ç–Ω–¥–≤–∏—á–µ–π, —Å–æ–¥–µ—Ä–∂–∞—â–∏–µ –º—è—Å–æ.

–ú—ã —Ö–æ—Ç–∏–º –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞—Ç—å —ç—Ç–æ—Ç —Å–ø–∏—Å–æ–∫ –≤ –µ–¥–∏–Ω—ã–π —Å–ø–∏—Å–æ–∫ –ø—Ä–æ–¥—É–∫—Ç–æ–≤. –õ–µ–≥—á–µ —Ä–∞–±–æ—Ç–∞—Ç—å —Å–æ —Å–ø–∏—Å–∫–æ–º —Å –æ–¥–Ω–∏–º –∏–∑–º–µ—Ä–µ–Ω–∏–µ–º, —á–µ–º —Å –¥–≤—É–º—è. –ù–µ—Ç –Ω–µ–æ–±—Ö–æ–¥–∏–º–æ—Å—Ç–∏ –∏–º–µ—Ç—å –±–æ–ª–µ–µ –æ–¥–Ω–æ–≥–æ –∏–∑–º–µ—Ä–µ–Ω–∏—è –≤ —ç—Ç–æ—Ç —Å–ø–∏—Å–æ–∫. –ß—Ç–æ–±—ã —É–¥–∞–ª–∏—Ç—å –≤—Ç–æ—Ä–æ–µ –∏–∑–º–µ—Ä–µ–Ω–∏–µ –∏–∑ –Ω–∞—à–µ–≥–æ —Å–ø–∏—Å–∫–∞, –º—ã –º–æ–∂–µ–º –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ø–∏—Å–∫–∞:

–ü–æ–Ω–∏–º–∞–Ω–∏–µ —ç—Ç–æ–≥–æ —Å–ø–∏—Å–∫–∞ –ø–æ–≤—Ç–æ—Ä—è–µ—Ç—Å—è –ø–æ –∫–∞–∂–¥–æ–º—É —Å–ø–∏—Å–∫—É –≤ " food " –ü–µ—Ä–µ–º–µ–Ω–Ω–∞—è Python . –ö–∞–∂–¥–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ –∑–∞—Ç–µ–º –¥–æ–±–∞–≤–ª—è–µ—Ç—Å—è –≤ –æ—Å–Ω–æ–≤–Ω–æ–π —Å–ø–∏—Å–æ–∫. –ü–æ—Å–ª–µ —Å–æ–∑–¥–∞–Ω–∏—è —Å–ø–∏—Å–∫–∞ –º—ã –≤—ã–≤–æ–¥–∏–º –µ–≥–æ –Ω–∞ –∫–æ–Ω—Å–æ–ª—å.

–î–∞–≤–∞–π—Ç–µ –∑–∞–ø—É—Å—Ç–∏–º –Ω–∞—à –∫–æ–¥ –∏ –ø–æ—Å–º–æ—Ç—Ä–∏–º, —á—Ç–æ –ø—Ä–æ–∏–∑–æ–π–¥–µ—Ç:

–ù–∞—à —Å–ø–∏—Å–æ–∫ —Å–ø–∏—Å–∫–æ–≤ —É—Å–ø–µ—à–Ω–æ –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞–Ω –≤ –ø–ª–æ—Å–∫–∏–π —Å–ø–∏—Å–æ–∫. –í—Å–µ –∏–Ω–≥—Ä–µ–¥–∏–µ–Ω—Ç—ã —Ç–µ–ø–µ—Ä—å –æ—Ç–æ–±—Ä–∞–∂–∞—é—Ç—Å—è –≤ –æ–¥–Ω–æ–º —Å–ø–∏—Å–∫–µ –≤–º–µ—Å—Ç–æ —Ç—Ä–µ—Ö.

–ú—ã —Ç–∞–∫–∂–µ –¥–æ—Å—Ç–∏–≥–∞–µ–º —Ç–æ–≥–æ –∂–µ —Ä–µ–∑—É–ª—å—Ç–∞—Ç–∞, –∏—Å–ø–æ–ª—å–∑—É—è –≤–ª–æ–∂–µ–Ω–Ω—ã–π —Ü–∏–∫–ª Python for . " –í–ª–æ–∂–µ–Ω–Ω—ã–π —Ü–∏–∫–ª for " - —ç—Ç–æ –µ—â–µ –æ–¥–∏–Ω —Å–ø–æ—Å–æ–± —Å–∫–∞–∑–∞—Ç—å "—Ü–∏–∫–ª for –≤–Ω—É—Ç—Ä–∏ —Ü–∏–∫–ª–∞ for". –ù–∞—à–µ –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ø–∏—Å–∫–∞ - —ç—Ç–æ –µ—â–µ –æ–¥–∏–Ω —Å–ø–æ—Å–æ–± –ø—Ä–µ–¥—Å—Ç–∞–≤–ª–µ–Ω–∏—è —Å–ª–µ–¥—É—é—â–µ–≥–æ —Ü–∏–∫–ª–∞ for:

–í –Ω–∞—à–µ–º –∫–æ–¥–µ –∏—Å–ø–æ–ª—å–∑—É—é—Ç—Å—è –¥–≤–∞ —Ü–∏–∫–ª–∞ for –¥–ª—è –ø–µ—Ä–µ–±–æ—Ä–∞ –∫–∞–∂–¥–æ–≥–æ —ç–ª–µ–º–µ–Ω—Ç–∞ —Å–ø–∏—Å–∫–∞ –≤ –∫–∞–∂–¥–æ–º —Å–ø–∏—Å–∫–µ –≤ –∏—Å—Ö–æ–¥–Ω–æ–º —Å–ø–∏—Å–∫–µ —Å–ø–∏—Å–∫–æ–≤. –î–∞–≤–∞–π—Ç–µ –∑–∞–ø—É—Å—Ç–∏–º –Ω–∞—à –∫–æ–¥:

–ù–∞—à–∞ –ø—Ä–æ–≥—Ä–∞–º–º–∞ –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç —Ç–æ—Ç –∂–µ —Ä–µ–∑—É–ª—å—Ç–∞—Ç, —á—Ç–æ –∏ –Ω–∞—à–µ –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ø–∏—Å–∫–∞. –í –±–æ–ª—å—à–∏–Ω—Å—Ç–≤–µ —Å–ª—É—á–∞–µ–≤ –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ø–∏—Å–∫–∞ —è–≤–ª—è–µ—Ç—Å—è –ª—É—á—à–∏–º —Ä–µ—à–µ–Ω–∏–µ–º, —á–µ–º —Ü–∏–∫–ª for. –°–æ—Å—Ç–∞–≤–Ω—ã–µ —á–∞—Å—Ç–∏ —Å–ø–∏—Å–∫–æ–≤ –∫–æ—Ä–æ—á–µ –∏ –≤ —ç—Ç–æ–º —Å–ª—É—á–∞–µ –∏—Ö –ª–µ–≥—á–µ —á–∏—Ç–∞—Ç—å, —á–µ–º –≤–ª–æ–∂–µ–Ω–Ω—ã–π —Ü–∏–∫–ª for.

Python: —Å–≥–ª–∞–¥–∏—Ç—å —Å–ø–∏—Å–æ–∫ —Å –ø–æ–º–æ—â—å—é Itertools

Itertools - —ç—Ç–æ –º–æ–¥—É–ª—å –≤ —Å—Ç–∞–Ω–¥–∞—Ä—Ç–Ω–æ–π –±–∏–±–ª–∏–æ—Ç–µ–∫–µ Python. –ú–æ–¥—É–ª—å –ø—Ä–µ–¥–æ—Å—Ç–∞–≤–ª—è–µ—Ç —Ä—è–¥ –º–µ—Ç–æ–¥–æ–≤, —É–ø—Ä–æ—â–∞—é—â–∏—Ö —Ä–∞–±–æ—Ç—É —Å –∏—Ç–µ—Ä–∞—Ç–∏–≤–Ω—ã–º–∏ –æ–±—ä–µ–∫—Ç—ã –∏ –≥–µ–Ω–µ—Ä–∞—Ç–æ—Ä—ã.

–î–ª—è –Ω–∞—à–∏—Ö —Ü–µ–ª–µ–π –º—ã —Å—Å—ã–ª–∞–µ–º—Å—è —Ç–æ–ª—å–∫–æ –Ω–∞ –º–µ—Ç–æ–¥ chain (). –≠—Ç–æ—Ç –º–µ—Ç–æ–¥ –ø—Ä–∏–Ω–∏–º–∞–µ—Ç —Å–ø–∏—Å–æ–∫ —Å–ø–∏—Å–∫–æ–≤ –∏ –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç —Å–≤–µ–¥–µ–Ω–Ω—ã–π —Å–ø–∏—Å–æ–∫.

< p> –ù–∞—á–Ω–∏—Ç–µ —Å –∏–º–ø–æ—Ä—Ç–∞ –º–æ–¥—É–ª—è itertools –≤ –Ω–∞—à –∫–æ–¥ —Å –ø–æ–º–æ—â—å—é –∏–Ω—Å—Ç—Ä—É–∫—Ü–∏–∏ –∏–º–ø–æ—Ä—Ç–∞ Python :

–ó–∞—Ç–µ–º –æ–ø—Ä–µ–¥–µ–ª–∏—Ç–µ —Å–ø–∏—Å–æ–∫ —Å–ø–∏—Å–∫–æ–≤ –∏ –∏—Å–ø–æ–ª—å–∑—É–π—Ç–µ –º–µ—Ç–æ–¥ chain () –¥–ª—è —Å–≥–ª–∞–∂–∏–≤–∞–Ω–∏—è —Å–ø–∏—Å–∫–∞:

–í –Ω–∞—à–µ–º –∫–æ–¥–µ –º—ã –∏—Å–ø–æ–ª—å–∑—É–µ–º —Å–∏–º–≤–æ–ª * –¥–ª—è —Ä–∞—Å–ø–∞–∫–æ–≤–∫–∏ –Ω–∞—à–µ–≥–æ —Å–ø–∏—Å–∫–∞. –≠—Ç–æ –ø—Ä–µ–æ–±—Ä–∞–∑—É–µ—Ç –Ω–∞—à —Å–ø–∏—Å–æ–∫ –≤ –∞—Ä–≥—É–º–µ–Ω—Ç—ã —Ñ—É–Ω–∫—Ü–∏–∏, –∫–æ—Ç–æ—Ä—ã–µ –º–æ–≥—É—Ç –±—ã—Ç—å –ø—Ä–æ–∞–Ω–∞–ª–∏–∑–∏—Ä–æ–≤–∞–Ω—ã –º–µ—Ç–æ–¥–æ–º chain ().

–ú–µ—Ç–æ–¥ chain () –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç –æ–±—ä–µ–∫—Ç itertools.chain. –ß—Ç–æ–±—ã —É–≤–∏–¥–µ—Ç—å –Ω–∞—à –ø–ª–æ—Å–∫–∏–π —Å–ø–∏—Å–æ–∫, –º—ã –¥–æ–ª–∂–Ω—ã –ø—Ä–µ–æ–±—Ä–∞–∑–æ–≤–∞—Ç—å —ç—Ç–æ—Ç –æ–±—ä–µ–∫—Ç –≤ —Å–ø–∏—Å–æ–∫. –ú—ã –¥–µ–ª–∞–µ–º —ç—Ç–æ —Å –ø–æ–º–æ—â—å—é –º–µ—Ç–æ–¥–∞ list ():

–î–∞–≤–∞–π—Ç–µ –≤—ã–ø–æ–ª–Ω–∏–º –Ω–∞—à –∫–æ–¥:

–ù–∞—à –∫–æ–¥ —Å–≥–ª–∞–¥–∏–ª –Ω–∞—à —Å–ø–∏—Å–æ–∫.

"–ö–∞—Ä—å–µ—Ä–∞ –ö–∞—Ä–º–∞ –≤–æ—à–ª–∞ –≤ –º–æ—é –∂–∏–∑–Ω—å —Ç–æ–≥–¥–∞, –∫–æ–≥–¥–∞ —è –±–æ–ª—å—à–µ –≤—Å–µ–≥–æ –≤ –Ω–µ–π –Ω—É–∂–¥–∞–ª–∞—Å—å, –∏ –±—ã—Å—Ç—Ä–æ –ø–æ–º–æ–≥–ª–∞ –º–Ω–µ –ø—Ä–æ–π—Ç–∏ –∫—É—Ä—Å –æ–±—É—á–µ–Ω–∏—è. –ß–µ—Ä–µ–∑ –¥–≤–∞ –º–µ—Å—è—Ü–∞ –ø–æ—Å–ª–µ –≤—ã–ø—É—Å–∫–∞ —è –Ω–∞—à–µ–ª —Ä–∞–±–æ—Ç—É —Å–≤–æ–µ–π –º–µ—á—Ç—ã, –∫–æ—Ç–æ—Ä–∞—è —Å–æ–æ—Ç–≤–µ—Ç—Å—Ç–≤–æ–≤–∞–ª–∞ –º–æ–∏–º —Ü–µ–Ω–Ω–æ—Å—Ç—è–º –∏ —Ü–µ–ª—è–º –≤ –∂–∏–∑–Ω–∏!"

–í–µ–Ω–µ—Ä–∞, –∏–Ω–∂–µ–Ω–µ—Ä-–ø—Ä–æ–≥—Ä–∞–º–º–∏—Å—Ç Rockbot

–•–æ—Ç—è itertools - —ç—Ñ—Ñ–µ–∫—Ç–∏–≤–Ω—ã–π —Å–ø–æ—Å–æ–± —Å–≥–ª–∞–∂–∏–≤–∞–Ω–∏—è —Å–ø–∏—Å–∫–∞, –æ–Ω –±–æ–ª–µ–µ –ø—Ä–æ–¥–≤–∏–Ω—É—Ç, —á–µ–º –¥–≤–∞ –ø–æ—Å–ª–µ–¥–Ω–∏—Ö –ø–æ–¥—Ö–æ–¥–∞, –∫–æ—Ç–æ—Ä—ã–µ –º—ã –æ–±—Å—É–∂–¥–∞–ª–∏.

–≠—Ç–æ –ø–æ—Ç–æ–º—É, —á—Ç–æ –≤—ã –¥–æ–ª–∂–Ω—ã –∏–º–ø–æ—Ä—Ç–∏—Ä–æ–≤–∞—Ç—å itertools –≤ —Å–≤–æ–π –∫–æ–¥, –∫–æ—Ç–æ—Ä—ã–π –≤–≤–æ–¥–∏—Ç –Ω–æ–≤—É—é –∑–∞–≤–∏—Å–∏–º–æ—Å—Ç—å. –ë–æ–ª–µ–µ —Ç–æ–≥–æ, –º–µ—Ç–æ–¥ chain () –≤–∫–ª—é—á–∞–µ—Ç —Ä–∞—Å–ø–∞–∫–æ–≤–∫—É, –∫–æ—Ç–æ—Ä—É—é —Ç—Ä—É–¥–Ω–æ –ø–æ–Ω—è—Ç—å. & Nbsp;

–ó–∞–∫–ª—é—á–µ–Ω–∏–µ

–í—ã –º–æ–∂–µ—Ç–µ —Å–≥–ª–∞–¥–∏—Ç—å —Å–ø–∏—Å–æ–∫ Python, –∏—Å–ø–æ–ª—å–∑—É—è –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ø–∏—Å–∫–∞, –≤–ª–æ–∂–µ–Ω–Ω—ã–π —Ü–∏–∫–ª for –∏ –º–µ—Ç–æ–¥ itertools.chain (). –ü–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ø–∏—Å–∫–∞ —è–≤–ª—è–µ—Ç—Å—è –Ω–∞–∏–±–æ–ª–µ–µ " –ø–∏—Ç–æ–Ω–∏—á–µ—Å–∫–∏–º " –º–µ—Ç–æ–¥ –∏ –ø–æ—ç—Ç–æ–º—É –ø—Ä–µ–¥–ø–æ—á—Ç–µ–Ω–∏–µ –æ—Ç–¥–∞–µ—Ç—Å—è –≤ –±–æ–ª—å—à–∏–Ω—Å—Ç–≤–µ —Å–ª—É—á–∞–µ–≤.

–•–æ—Ç—è –≤–ª–æ–∂–µ–Ω–Ω—ã–µ —Ü–∏–∫–ª—ã for —ç—Ñ—Ñ–µ–∫—Ç–∏–≤–Ω—ã, –æ–Ω–∏ –ø–æ—Ç—Ä–µ–±–ª—è—é—Ç –±–æ–ª—å—à–µ —Å—Ç—Ä–æ–∫ –∫–æ–¥–∞, —á–µ–º –ø–æ–Ω–∏–º–∞–Ω–∏–µ —Å–ø–∏—Å–∫–∞. –ú–µ—Ç–æ–¥ itertools.chain () —Ç–∞–∫–∂–µ —ç—Ñ—Ñ–µ–∫—Ç–∏–≤–µ–Ω, –Ω–æ –µ–≥–æ –º–æ–∂–µ—Ç –±—ã—Ç—å —Å–ª–æ–∂–Ω–æ –ø–æ–Ω—è—Ç—å –Ω–æ–≤–∏—á–∫–∞–º.

–û–±—ã—á–Ω–æ –Ω–µ—Ç –Ω–µ–æ–±—Ö–æ–¥–∏–º–æ—Å—Ç–∏ –∏–º–ø–æ—Ä—Ç–∏—Ä–æ–≤–∞—Ç—å –Ω–æ–≤—É—é –±–∏–±–ª–∏–æ—Ç–µ–∫—É & mdash; itertools & mdash; –∫–æ–≥–¥–∞ Python –ø—Ä–µ–¥–æ—Å—Ç–∞–≤–ª—è–µ—Ç –≤–∞–º –≤—Å–µ –∏–Ω—Å—Ç—Ä—É–º–µ–Ω—Ç—ã, –Ω–µ–æ–±—Ö–æ–¥–∏–º—ã–µ –¥–ª—è —Å–≥–ª–∞–∂–∏–≤–∞–Ω–∏—è —Å–ø–∏—Å–∫–∞.

–•–æ—Ç–∏—Ç–µ —É–∑–Ω–∞—Ç—å –±–æ–ª—å—à–µ –æ Python? –û–∑–Ω–∞–∫–æ–º—å—Ç–µ—Å—å —Å –Ω–∞—à–∏–º –ø–æ–ª–Ω—ã–º —Ä—É–∫–æ–≤–æ–¥—Å—Ç–≤–æ–º –ø–æ –∏–∑—É—á–µ–Ω–∏—é Python . –í—ã –Ω–∞–π–¥–µ—Ç–µ —Å–æ–≤–µ—Ç—ã —ç–∫—Å–ø–µ—Ä—Ç–æ–≤ –ø–æ –æ–±—É—á–µ–Ω–∏—é, –∞ —Ç–∞–∫–∂–µ —Å–ø–∏—Å–æ–∫ –ª—É—á—à–∏—Ö –∫—É—Ä—Å–æ–≤ –∏ –∫–Ω–∏–≥, –∏–∑ –∫–æ—Ç–æ—Ä—ã—Ö –≤—ã –º–æ–∂–µ—Ç–µ –∏–∑—É—á–∏—Ç—å .

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

News


Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method