Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!rt.uk.eu.org!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.105 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.79; '*S*': 0.00; '[0]': 0.09; 'val': 0.09; 'subject:How': 0.10; 'res': 0.16; 'index': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'header:User-Agent:1': 0.23; 'header:In-Reply- To:1': 0.27; 'point': 0.28; 'am,': 0.29; '(like': 0.30; 'code': 0.31; 'index,': 0.31; 'probably': 0.32; 'know.': 0.32; 'maybe': 0.34; "i'd": 0.34; 'but': 0.35; 'there': 0.35; 'fun,': 0.36; 'next': 0.36; 'subject:?': 0.36; 'two': 0.37; 'list': 0.37; 'to:addr:python-list': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; "you're": 0.61; "you've": 0.63; 'received:74.208': 0.68; 'million': 0.74; 'subject:this': 0.83; 'ana': 0.84; 'received:74.208.4.194': 0.84 Date: Mon, 01 Apr 2013 07:53:44 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: python-list@python.org Subject: Re: How to do this? References: <83a54022-576d-465b-b6bd-7e21cde59d99@googlegroups.com> <29fa109e-8ed0-4b1b-a9c0-473e2bace687@googlegroups.com> In-Reply-To: <29fa109e-8ed0-4b1b-a9c0-473e2bace687@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:K40zo76vYNXOCdO0i6K9QavQl8RLNTIMjvTGX5pg0Hp xBEG4UK8BAk+mFiUQW4JeCX3LD0puHX8vTMbhDJ8jpc9FALJzF cXalpVcXMQ7AwP02IZhQlVr+SNBcFUNTbZ/sW3uxsYtyxYrnpO 6yxLLuz5fdO6wmatpFbhtsTJkqrfx7N0aCzxq39cSxhyCIJZhA CY5swI0uFhir35+Twlcnj54OS0ldL/KEDVf6omWj0wY2ai49R+ gowmK/WFE/evR4XKqL18PND67Pe9hYmGSs1/FEd66G0bx7v7uG VD0E4+cJ6TK096FCV+XDw4iZYUoGt2HkNRE0s8bCMndF11oXw= = 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: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364817250 news.xs4all.nl 6882 [2001:888:2000:d::a6]:57256 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42458 On 04/01/2013 07:08 AM, Ana Dionísio wrote: > [0 0 0 0 0.17 0.17 0.17 0.17 0 0 0 0.17 0.17 0.17 0 0 0 0 0 0 0] I'd do res = "[0 0 0 0 0.17 0.17 0.17 0.17 0 0 0 0.17 0.17 0.17 0 0 0 0 0 0 0]" Unless there's a pattern you're trying to accomplish (like maybe next time you want to do "it" for a list of two million items), there's little point in writing code to do what you've already predetermined. And if there is a pattern, you'd probably better let us know. But if it's for fun, vt = [0] * 21 for index, val in enumerate(vt): if 3