Re: [Tutor] new user question about while loops

2005-10-25 Thread Nick Eberle
print "This is a coin flip game"   print "\n100 flips will be made and it will show the amount of times heads or tails came up"   import random #assigning variables to track the amount of times heads or tails comes up heads=0tails=1   flip=100while flip < 100:    flip -= 1    random.randra

Re: [Tutor] new user question about while loops

2005-10-25 Thread bob
At 10:53 PM 10/25/2005, Nick Eberle wrote: Content-class: urn:content-classes:message Content-Type: multipart/alternative; boundary="_=_NextPart_001_01C5D9F1.A836CF4F" Sorry for potential double post, error with first send --

[Tutor] new user question about while loops

2005-10-25 Thread Nick Eberle
Sorry for potential double post, error with first send -- Hello all,   I had a new question about python. I am pretty much in tutorial learning stages, but attempting to create sample programs not in my book to learn how to cons

Re: [Tutor] threading issues

2005-10-25 Thread Chris Hallman
You're right. I'm inexperienced with classes and threading. The example you gave (www.wellho.net) was the same example I used as the basis for my script however I wasn't able to get it to work. I couldn't figure out what the -q parameter is (it's not a valid parameter on the *nix I have access to)

Re: [Tutor] python myspace module?

2005-10-25 Thread nephish
Hey there Ed, if you pull this off, let us know. i have wanted to do this very thing, but just don't have the time. sk On Tue, 2005-10-25 at 14:24 -0700, Danny Yoo wrote: > > On Tue, 25 Oct 2005, Ed Hotchkiss wrote: > > > looking to write a myspace wrapper/module. what is the b

Re: [Tutor] identify python interpreters platform?

2005-10-25 Thread Brian van den Broek
Kent Johnson said unto the world upon 2005-10-25 11:46: > Ed Hotchkiss wrote: > >> Well, on windows XP it returns "nt" for os.name >> and for sys.platform it returns win32. how can i determine win2k, >> xp, 9x, etc etc ... > > > I don't know...maybe something in os.environ? >

Re: [Tutor] downloading remote files

2005-10-25 Thread Kent Johnson
Ed Hotchkiss wrote: > is there a method in the stdlib of downloading a remote file via HTTP? > or do i need sockets ... for simple needs, you can use urllib: import urllib data = urllib.urlopen('http://www.google.com').read() For more control, see urllib2. As suggested recently, Dive into Python

[Tutor] downloading remote files

2005-10-25 Thread Ed Hotchkiss
is there a method in the stdlib of downloading a remote file via HTTP? or do i need sockets ...-- edward hotchkiss ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] python myspace module?

2005-10-25 Thread Danny Yoo
On Tue, 25 Oct 2005, Ed Hotchkiss wrote: > looking to write a myspace wrapper/module. what is the best way > (hopefully using the stdlib not an outside module) to connect to a > website and (if possible, otherwise ill have to code it?) access forms > with GET POST blah blah blah ... Hi Ed, We

Re: [Tutor] py in a nut

2005-10-25 Thread Alan Gauld
> Programming Python, 3E which should be released in December. > > So there is no Advanced Python book on the horizon, which is a shame. > But as you can see, Python in a Nutshell 2nd edition is due out next > March. If PP continues the trend of the 2nd edition it could well be the book you wan

[Tutor] python myspace module?

2005-10-25 Thread Ed Hotchkiss
looking to write a myspace wrapper/module. what is the best way (hopefully using the stdlib not an outside module) to connect to a website and (if possible, otherwise ill have to code it?) access forms with GET POST blah blah blah ...   thanks!-- edward hotchkiss

Re: [Tutor] identify python interpreters platform?

2005-10-25 Thread Ed Hotchkiss
print os.environ("OS") - i need to run it on diff platforms that i dont have with me now, but i think it should work fine, otherwise ill get a workaround then post it to the list. thanks   -edward ___ Tutor maillist - Tutor@python.org http://mail.pytho

Re: [Tutor] identify python interpreters platform?

2005-10-25 Thread Kent Johnson
Ed Hotchkiss wrote: > Well, on windows XP it returns "nt" for os.name and for > sys.platform it returns win32. how can i determine win2k, xp, 9x, etc > etc ... I don't know...maybe something in os.environ? ___ Tutor maillist - Tutor

Re: [Tutor] identify python interpreters platform?

2005-10-25 Thread Ed Hotchkiss
Well, on windows XP it returns "nt" for os.name and for sys.platform it returns win32. how can i determine win2k, xp, 9x, etc etc ...   -edward ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] identify python interpreters platform?

2005-10-25 Thread Kent Johnson
Ed Hotchkiss wrote: > > how can i use the os module (or something else?) to determine what > platform the interpreter is running on? Try sys.platform Kent -- http://www.kentsjohnson.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/

[Tutor] identify python interpreters platform?

2005-10-25 Thread Ed Hotchkiss
how can i use the os module (or something else?) to determine what platform the interpreter is running on?-- edward hotchkiss ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] py in a nut

2005-10-25 Thread Kent Johnson
Damien Gouteux wrote: > In french, 'Python précis & concis', from O'Reilly is now out : from > Mark Lutz, it covers python 2.4 (and decorators). > I assume there is a english edition of this book. Probably Python Pocket Reference, Third Edition http://www.oreilly.com/catalog/pythonpr3/ Kent ___

Re: [Tutor] py in a nut

2005-10-25 Thread Frank Moore
Damien Gouteux wrote: > In french, 'Python précis & concis', from O'Reilly is now out : from > Mark Lutz, it covers python 2.4 (and decorators). > I assume there is a english edition of this book. Yes, that's the Python Pocket Reference. It does have 1 (small) page on decorators, but nothing on

Re: [Tutor] py in a nut

2005-10-25 Thread Damien Gouteux
In french, 'Python précis & concis', from O'Reilly is now out : from Mark Lutz, it covers python 2.4 (and decorators). I assume there is a english edition of this book. Frank Moore wrote: Kent Johnson wrote: Have you looked at Python Cookbook 2E? Chapter 19 is "Iterators and Gene

Re: [Tutor] py in a nut

2005-10-25 Thread Frank Moore
Kent Johnson wrote: >Have you looked at Python Cookbook 2E? Chapter 19 is "Iterators and >Generators". Chapter 20 is "Descriptors, Decorators and Metaclasses". > > I have. But I'd rather have a complete book on these subjects ;-) I'm sure someone will write one in the end. Hopefully Alex Martel

Re: [Tutor] testing for modules?

2005-10-25 Thread Frank Moore
Shitiz Bansal wrote: >try: > import >except: > > import > > >--- Ed Hotchkiss <[EMAIL PROTECTED]> wrote: > > > Explicit is always better than implicit... try: import except ImportError:# Only catch import errors import Cheers, F. _

Re: [Tutor] py in a nut

2005-10-25 Thread Kent Johnson
Frank Moore wrote: > I mailed O'Reilly in June of this year to ask about any Python books on > the horizon. > I particularly wanted to know if an 'Advanced Python' book was on the > cards. > Something that included subjects like Descriptors, Generators, > Iterators, Metaclasses, Decorators, Desi

Re: [Tutor] manipulating list of lists

2005-10-25 Thread Kent Johnson
John Fouhy wrote: > On 25/10/05, Brian van den Broek <[EMAIL PROTECTED]> wrote: > >>To sort by the second item, try >> >> >>> def sort_by_second(sequence): >>decorated = [(x[1], x) for x in sequence] >>decorated.sort() >>return [x[1] for x in decorated] > > > With python2

Re: [Tutor] testing for modules?

2005-10-25 Thread Shitiz Bansal
try: import except: import --- Ed Hotchkiss <[EMAIL PROTECTED]> wrote: > i have a generic script that is using several > modules on windows and linux > boxes. i need to have the scripts test if a module > is installed, and then if > not - then to install the module. can anyone give m

Re: [Tutor] py in a nut

2005-10-25 Thread Frank Moore
[EMAIL PROTECTED] wrote: > Hope this is not too off topic: > I noticed that the Python in a Nutshell book is version 2.2 and a few > years old. Does anyone know if there are plans to bring out a new > edition anytime soon? I checked the O'reilly page and didnt find > anything, also googled it