help fast question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alex Endl

    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?


  • djw

    #2
    Re: help fast question

    Alex Endl wrote:[color=blue]
    > 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.[/color]

    Source code: Lib/random.py This module implements pseudo-random number generators for various distributions. For integers, there is uniform selection from a range. For sequences, there is uniform s...

    [color=blue]
    >
    > 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?
    >
    >[/color]

    Source code: Lib/socket.py This module provides access to the BSD socket interface. It is available on all modern Unix systems, Windows, MacOS, and probably additional platforms. Availability: not ...

    Source code: Lib/http/client.py This module defines classes that implement the client side of the HTTP and HTTPS protocols. It is normally not used directly — the module urllib.request uses it to h...




    Comment

    • Dan Bishop

      #3
      Re: help fast question

      "Alex Endl" <alexendl@hotma il.com> wrote in message news:<10fgnc8js dd2779@corp.sup ernews.com>...[color=blue]
      > 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.[/color]

      import random
      a = random.randint( 1, 5) # includes both endpoints
      b = random.randrang e(1, 6) # includes left endpoint, excludes right
      [color=blue]
      > 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?[/color]

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

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

      Comment

      Working...