473,399 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

help fast question

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?
Jul 18 '05 #1
2 1417
djw
Alex Endl wrote:
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
Jul 18 '05 #2
"Alex Endl" <al******@hotmail.com> wrote in message news:<10*************@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.
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

32
by: dan | last post by:
It would be an understatement to say I love this language. What used to take me all day now takes 3 hours, and I can spend the rest of the time on my bike thinking about the problems from a high...
0
by: Kevin T. Ryan | last post by:
Hi All - I'm trying to develop web applications using python / Cheetah. I'm also trying to experiment with lighttpd (see www.lighttpd.net), which supports fast-cgi. So, I downloaded Robin...
31
by: mark | last post by:
Hello- i am trying to make the function addbitwise more efficient. the code below takes an array of binary numbers (of size 5) and performs bitwise addition. it looks ugly and it is not elegant...
4
by: Thomas Christmann | last post by:
Hi! First let me apologize for asking this question when there are so many answers to it on Google, but most of them are really contradicting, and making what I want to do very performant is...
20
by: GS | last post by:
The stdint.h header definition mentions five integer categories, 1) exact width, eg., int32_t 2) at least as wide as, eg., int_least32_t 3) as fast as possible but at least as wide as, eg.,...
6
by: Tamir Khason | last post by:
I have parent-child hashtable with more then 900K items and I have to build all pathes for this. E.G Key ParentKey 1 0 2 1 3 2 4 8 5 3 6 1 7 ...
4
by: Jean-François Blais | last post by:
Many must have asked that question. I intend to write a few programs which will be CPU intensive. I know a little of Java. Would a language that yields native code, instead of bytecode perfrom much...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
12
by: Boris Ozegovic | last post by:
Hi, I am working on some system, and the communication will take place through the chatterbot which will be written in AIML (interpreter is written in Python). English is not my mother tongue,...
3
by: Nash | last post by:
Hi All, I have set of data which needs to be stored in a file. The data is classified into categories say Cat 1, Cat 2... Cat 10 each category can have any number of entries. The program allows...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.