Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!bcyclone03.am1.xlned.com!bcyclone03.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4a.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.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:error': 0.03; 'integers': 0.09; 'iterate': 0.09; 'lawrence': 0.09; 'suggest': 0.14; 'question.': 0.14; '>>on': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'get,': 0.16; 'happened?': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'syntax,': 0.16; 'traceback.': 0.16; 'wrote:': 0.18; 'obviously': 0.18; 'wed,': 0.18; 'thu,': 0.19; 'solution.': 0.20; '>>>': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'string,': 0.24; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'work.': 0.31; 'code': 0.31; "skip:' 10": 0.31; '+0100,': 0.31; '>>>>': 0.31; 'correctly.': 0.31; 'actual': 0.34; 'received:84': 0.35; 'there': 0.35; 'yield': 0.36; 'thanks': 0.36; 'should': 0.36; 'error.': 0.37; 'to:addr:python-list': 0.38; 'short': 0.38; 'expect': 0.39; 'to:addr:python.org': 0.39; 'subject: ': 0.61; 'full': 0.61; 'numbers': 0.61; 'simply': 0.61; "you've": 0.63; 'happen': 0.63; 'more': 0.64; 'invalid': 0.68; 'prompt': 0.68; 'url:a': 0.72; 'click': 0.77; 'hand': 0.80; 'url:imgur': 0.84; 'subject:Lists': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=ceBcrxzM c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=aoAcgTy3oA8A:10 a=ihvODaAuJD4A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=BrDiTsk0AAAA:8 a=TaEwxo0IAAAA:20 a=rAWiKY3weBjM4lURnXgA:9 a=DLLBnhW2aw0uHMEM:21 a=2EsVBIru0v_9qtxU:21 a=QEXdDO2ut3YA:10 a=-hJg1tCh9CgA:10 X-AUTH: mrabarnett:2500 Date: Thu, 23 Oct 2014 02:29:43 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: I am out of trial and error again Lists References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1414027786 news.xs4all.nl 2927 [2001:888:2000:d::a6]:50717 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 4922 X-Received-Body-CRC: 2860141091 Xref: csiph.com comp.lang.python:79491 On 2014-10-23 01:02, Seymore4Head wrote: > On Thu, 23 Oct 2014 00:44:01 +0100, Mark Lawrence > wrote: > >>On 23/10/2014 00:26, Seymore4Head wrote: >>> On Wed, 22 Oct 2014 23:55:57 +0100, Mark Lawrence >>> wrote: >>> >>>> On 22/10/2014 23:30, Seymore4Head wrote: >>>>> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head >>>>> wrote: >>>>> >>>>> One more question. >>>>> if y in str(range(10) >>>>> Why doesn't that work. >>>> >>>> Invalid syntax, it should obviously be:- >>>> >>>> if y in str(range(10)): >>>> >>>> OTOH if you've simply mistyped above what did you expect to happen and >>>> what actually happened? Give us the actual code that you ran and the >>>> full traceback. >>> >>> I don't get an error. It just doesn't print the numbers correctly. >>> http://imgur.com/a/2loQV >>> You can click on the images and make them larger. >>> Thanks >>> >> >>I suggest you try str(range(10)) from the interactive prompt and see >>exactly what you get, as it's nothing like what you expect :) > > I see that now. So there may not be a short hand solution. > range(10) will yield the integers 0-9. You can iterate over them, turning each into a string, and then join them together: ''.join(str(n) for n in range(10))