help fast question

A

Alex Endl

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.

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?
 
D

djw

Alex said:
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.
http://docs.python.org/lib/module-random.html


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?

http://docs.python.org/lib/module-socket.html
http://docs.python.org/lib/module-httplib.html
http://docs.python.org/lib/module-HTMLParser.html
 
D

Dan Bishop

Alex Endl said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,662
Latest member
salsusa

Latest Threads

Top