Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'url:pipermail': 0.05; 'string': 0.09; 'iterate': 0.09; 'subject:string': 0.09; 'question.': 0.14; 'chunks': 0.16; 'itertools': 0.16; 'manageable': 0.16; 'nick': 0.16; 'to:name:python list': 0.16; 'url:312443': 0.16; 'url:how-do-you-split-a-list-into-evenly- sized-chunks-in-python': 0.16; 'proposed': 0.22; 'solutions.': 0.26; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; 'url:bugs': 0.29; 'received:169.254': 0.32; 'url:python': 0.33; 'common': 0.35; 'but': 0.35; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'received:169': 0.37; 'received:10': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'received:10.242': 0.84; 'subject:long': 0.84 From: Nick Cash To: Roy Smith , Python List Subject: RE: chunking a long string? Thread-Topic: chunking a long string? Thread-Index: AQHO3Kq6Qfff5vpV+kmRm4S6FZPAAZobnh2g Date: Fri, 8 Nov 2013 17:59:33 +0000 References: <9258483E-76BD-4D96-8C46-7262A95E3ED4@panix.com> In-Reply-To: <9258483E-76BD-4D96-8C46-7262A95E3ED4@panix.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [70.166.238.194] x-forefront-prvs: 00246AB517 x-forefront-antispam-report: SFV:NSPM; SFS:(22134002)(189002)(199002)(81686001)(77982001)(76482001)(56776001)(54316002)(15395725003)(81816001)(54356001)(51856001)(15202345003)(46102001)(63696002)(15975445006)(77096001)(59766001)(47736001)(49866001)(50986001)(47976001)(79102001)(4396001)(53806001)(56816003)(76796001)(76786001)(76576001)(65816001)(69226001)(74502001)(47446002)(74662001)(85306002)(2656002)(87266001)(81542001)(74366001)(74316001)(83072001)(33646001)(31966008)(81342001)(80976001)(66066001)(74706001)(83322001)(80022001)(19580395003)(74876001)(87936001)(24736002); DIR:OUT; SFP:; SCL:1; SRVR:BY2PR06MB236; H:BY2PR06MB233.namprd06.prod.outlook.com; CLIP:70.166.238.194; FPR:; RD:InfoNoRecords; MX:1; A:1; LANG:en; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: npcinternational.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1383933591 news.xs4all.nl 15927 [2001:888:2000:d::a6]:59431 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:58827 > I have a long string (several Mbytes). I want to iterate over it in mana= geable chunks This is a weirdly common question. See http://stackoverflow.com/questions/3= 12443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python for severa= l solutions. It's been proposed to be added to itertools before, but rejected: https://m= ail.python.org/pipermail/python-ideas/2012-July/015671.html and http://bugs= .python.org/issue13095=20 - Nick Cash=20