Hi Alan thanks for the help. I did try the getpass module, I think I used: getpass.getpass()
This actually prompted the user to enter a password, which isn't really what I want. Unless there's something i'm missing with this module? I'll take another look anyway. On 19 July 2010 11:00, <tutor-requ...@python.org> wrote: > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/tutor > or, via email, send a message with subject or body 'help' to > tutor-requ...@python.org > > You can reach the person managing the list at > tutor-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Tutor digest..." > > > Today's Topics: > > 1. Re: A file containing a string of 1 billion random digits. > (Richard D. Moores) > 2. Re: Help with Hangman program (Alan Gauld) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Mon, 19 Jul 2010 02:17:48 -0700 > From: "Richard D. Moores" <rdmoo...@gmail.com> > To: bob gailer <bgai...@gmail.com> > Cc: tutor@python.org > Subject: Re: [Tutor] A file containing a string of 1 billion random > digits. > Message-ID: > <aanlktimfilak6vsxwaub4zp_xi_qdxy7itk9stldn...@mail.gmail.com> > Content-Type: text/plain; charset=UTF-8 > > On Sun, Jul 18, 2010 at 11:07, bob gailer <bgai...@gmail.com> wrote: > > > Check this out: > > > > import random, time > > s = time.time() > > cycles = 1000 > > d = "0123456789"*100 > > f = open("numbers.txt", "w") > > for i in xrange(n): > > l = [] > > l.extend(random.sample(d, 1000)) > > f.write(''.join(l)) > > f.close() > > print time.time() - s > > > > 1 million in ~1.25 seconds > > > > Therefore 1 billion in ~21 minutes. 3 ghz processor 2 g ram. > > > > Changing length up or down seems to increase time. > > Putting "cycles" where you have "n", I used > > import random, time > s = time.time() > cycles = 1000000 > d = "0123456789"*100 > f = open("/p31working/Data/1billion_digits_rand_num_Gailor.txt", "w") > for i in range(cycles): > l = [] > l.extend(random.sample(d, 1000)) > f.write(''.join(l)) > f.close() > print(time.time() - s) > > to get 1 billion random digits into a file in 932 seconds (15.6 > minutes). <http://tutoree7.pastebin.com/Ldh6SX3q>, which uses Steve > D'Aprano's random_digits function, took 201 seconds (3.35 minutes). > > Still, I understand yours, and not his (the return line). I'd never > noticed random.sample() before, nor tried out extend() on a list. So > thanks, Bob. > > Dick > > > ------------------------------ > > Message: 2 > Date: Mon, 19 Jul 2010 10:20:58 +0100 > From: "Alan Gauld" <alan.ga...@btinternet.com> > To: tutor@python.org > Subject: Re: [Tutor] Help with Hangman program > Message-ID: <i215dm$mi...@dough.gmane.org> > Content-Type: text/plain; format=flowed; charset="iso-8859-1"; > reply-type=original > > > "John Palmer" <speederpyt...@gmail.com> wrote > > > I have the program working nearly as I want it to be. The only > > problem is, > > that when the user is prompted to enter its chosen word, (I am using > > a raw > > input) and the word is typed in, it shows in the line above, > > Take a look at the getpass module. > > HTH, > > > -- > Alan Gauld > Author of the Learn to Program web site > http://www.alan-g.me.uk/ > > > > > ------------------------------ > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > > End of Tutor Digest, Vol 77, Issue 68 > ************************************* >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor