Article View: chile.comp.programacion
Article #558Re: Mezclar string
From: Cristian Gutierrez
Date: Sun, 16 Mar 2008 09:11
Date: Sun, 16 Mar 2008 09:11
22 lines
1704 bytes
1704 bytes
Rodrigo Barrientos L. wrote: > Waaah.. por eso me gusta python :) > >>>> s1='1235' >>>> s2='67829' >>>> ''.join([(s1[i] if i < len(s1) else '') + (s2[i] if i < len(s2) else '') for i >>>> in range(max(len(s1), len(s2)))]) > '162738529' > > Conciso y preciso (si bien algo atadoso de entender). Muy largo! >>> s1='1235' >>> s2='67829' >>> print ''.join([''.join(x) for x in zip(s1,s2)]) + (s2[len(s1):] + s1[len(s2):]) 162738529 -- Guti
Technical Details
Message-ID:
<873aqrdoea.fsf@dogbert.simple.cl>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news.kjsl.com!news.nivel5.cl!news.vcd.cl!not-for-mail!news.cec.uchile.cl!not-for-mailReferences:
<3394b760-72db-46a1-a587-80153b21be4c@i29g2000prf.googlegroups.com> <Xns9A58AEBD24FD9jmsnews@201.238.250.229> <80a9289e-ea0a-4618-9ccc-170a4a54032e@p73g2000hsd.googlegroups.com> <2bb9b53b-5593-4dae-8090-fb53244b760a@e25g2000prg.googlegroups.com> <fqovjn$tea$1@helcaraxe.dcc.uchile.cl>Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,43187c159ac77009 X-Google-Attributes: gid1593cb,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Cristian Gutierrez <crgutier@dcc.uchile.cl> Newsgroups: chile.comp.programacion Subject: Re: Mezclar string Date: Sun, 16 Mar 2008 05:11:25 -0400 Organization: DCC/Uchile Lines: 22 Message-ID: <873aqrdoea.fsf@dogbert.simple.cl> References: <3394b760-72db-46a1-a587-80153b21be4c@i29g2000prf.googlegroups.com> <Xns9A58AEBD24FD9jmsnews@201.238.250.229> <80a9289e-ea0a-4618-9ccc-170a4a54032e@p73g2000hsd.googlegroups.com> <2bb9b53b-5593-4dae-8090-fb53244b760a@e25g2000prg.googlegroups.com> <fqovjn$tea$1@helcaraxe.dcc.uchile.cl> NNTP-Posting-Host: vpn-client-022.cec.uchile.cl Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: cipres.cec.uchile.cl 1205655089 28199 172.17.35.22 (16 Mar 2008 08:11:29 GMT) X-Complaints-To: news@cipres.cec.uchile.cl NNTP-Posting-Date: Sun, 16 Mar 2008 08:11:29 +0000 (UTC) User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1.50 (gnu/linux) Cancel-Lock: sha1:PsfUS9+ShzxrUs8UKsgDFpu1fMc= Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news.kjsl.com!news.nivel5.cl!news.vcd.cl!not-for-mail!news.cec.uchile.cl!not-for-mail