I am out of trial and error again Lists
MRAB
python at mrabarnett.plus.com
Wed Oct 22 21:29:43 EDT 2014
More information about the Python-list mailing list
Wed Oct 22 21:29:43 EDT 2014
- Previous message (by thread): I am out of trial and error again Lists
- Next message (by thread): I am out of trial and error again Lists
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2014-10-23 01:02, Seymore4Head wrote: > On Thu, 23 Oct 2014 00:44:01 +0100, Mark Lawrence > <breamoreboy at yahoo.co.uk> wrote: > >>On 23/10/2014 00:26, Seymore4Head wrote: >>> On Wed, 22 Oct 2014 23:55:57 +0100, Mark Lawrence >>> <breamoreboy at yahoo.co.uk> wrote: >>> >>>> On 22/10/2014 23:30, Seymore4Head wrote: >>>>> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head >>>>> <Seymore4Head at Hotmail.invalid> 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))
- Previous message (by thread): I am out of trial and error again Lists
- Next message (by thread): I am out of trial and error again Lists
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list