help fast question

Dan Bishop danb_83 at yahoo.com
Fri Jul 16 22:49:59 EDT 2004


"Alex Endl" <alexendl at hotmail.com> wrote in message news:<10fgnc8jsdd2779 at corp.supernews.com>...
> Ok i took an intro to programming class in school, and decided to work on
> python in the summer.
> 
> 
> a few thing
> 
> 1)how do I make a variable a random #  a = randint(1,5)
>      seems logical, but i cant find a directory of commands to figure it
> out.

import random
a = random.randint(1, 5)    # includes both endpoints
b = random.randrange(1, 6)  # includes left endpoint, excludes right

> 2)i cant find much info on sockets, and thats a big reason i want to
> program.  what im trying to figure out is something that goes to a website,
> picks up some specified text, and shows it on the screen.   is this
> possible?

Take a look at the urllib, httplib, and socket modules.

To see the documentation for a module, type help('modulename') at the
interactive prompt.



More information about the Python-list mailing list