Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Banned jan1024188's Avatar
    Join Date
    Jul 2006
    Location
    EU, SLOVENIA
    Posts
    1,549

    complete n00b to python >>> read command


    ok i decided to start learning python
    if i have
    echo -n "blablabla"
    read bla

    than in python which command is for that read?

    sory for superstupid question...

  2. #2
    Banned jan1024188's Avatar
    Join Date
    Jul 2006
    Location
    EU, SLOVENIA
    Posts
    1,549
    and is def in python the same like function in shellscript?

  3. #3
    Quote Originally Posted by jan1024188
    echo -n "blablabla"
    read bla
    To echo something to the stdout, simply use
    Code:
    print "blah"
    To read seomthing from the input, prompting the user to key in something
    Code:
    answer = raw_input('Enter something: ")
    Quote Originally Posted by jan1024188
    and is def in python the same like function in shellscript?
    Yes, def is used for declaring functions, eg
    Code:
    def multiply(a,b):
          return a * b
    Then the call this function,
    Code:
    multiply(1,2)
    May i suggest you look at the tutorial here http://docs.python.org/tut/

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •