Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 46

Thread: Super basic python problem (I'm very new and trying to learn python)

  1. #11
    Join Date
    Mar 2007
    Beans
    1,046

    Re: Super basic python problem (I'm very new and trying to learn python)

    Quote Originally Posted by Gilabuugs View Post
    Try starting off with a much lighter book than dive into python, the FAQs at the top have a few links for beginners,

    here is a more friendly book:

    http://www.swaroopch.com/byteofpython/

    How to think like a CS with python is good as well:

    http://www.greenteapress.com/thinkpython/thinkCSpy/
    Thanks! I'm reading byteofpython now!
    Apps for Ubuntu (outdated) ---> http://cid-23a283fc1010a1bb.skydrive...%20Wine|6?uc=1
    Use Mnemosyne to Study for School!

  2. #12
    Join Date
    Jun 2006
    Location
    CT, USA
    Beans
    5,267
    Distro
    Ubuntu 6.10 Edgy

    Re: Super basic python problem (I'm very new and trying to learn python)

    Dive into Python is not for beginner programmers - author assumes experience in other language, and just dives in.

    Check wiki in my sig for good links (also linked from sticky FAQ)

  3. #13
    Join Date
    Mar 2007
    Beans
    1,046

    Re: Super basic python problem (I'm very new and trying to learn python)

    I dont understand the following from byteofpython:

    You are now able to run the program as long as you know the exact path of the program - but what if
    you wanted to be able to run the program from anywhere? You can do this by storing the program in one
    of the directories listed in the PATH environment variable. Whenever you run any program, the system
    looks for that program in each of the directories listed in the PATH environment variable and then runs
    that program. We can make this program available everywhere by simply copying this source file to one
    of the directories listed in PATH.
    $ echo $PATH
    /opt/mono/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/swaroop/bin
    $ cp helloworld.py /home/swaroop/bin/helloworld
    $ helloworld
    Hello World


    Can someone explain it to me in further detail please?
    Apps for Ubuntu (outdated) ---> http://cid-23a283fc1010a1bb.skydrive...%20Wine|6?uc=1
    Use Mnemosyne to Study for School!

  4. #14
    Join Date
    Sep 2006
    Beans
    2,914

    Re: Super basic python problem (I'm very new and trying to learn python)

    that's the problem of not getting familiar with your shell and shell environments before plunging into Python. Explanation here

  5. #15
    Join Date
    Apr 2007
    Beans
    14,781

    Re: Super basic python problem (I'm very new and trying to learn python)

    Quote Originally Posted by s3a View Post
    Can someone explain it to me in further detail please?
    It doesn't matter what it means; you shouldn't be altering your $PATH without knowledge of it. Just run your programs using absolute paths (or the "." for the CWD)

  6. #16
    Join Date
    Mar 2007
    Beans
    1,046

    Re: Super basic python problem (I'm very new and trying to learn python)

    Well, I guess it is trying to show me how to run my programs regardless of where they are but, cding to directory alone should do it for me [atleast for now], right?
    Apps for Ubuntu (outdated) ---> http://cid-23a283fc1010a1bb.skydrive...%20Wine|6?uc=1
    Use Mnemosyne to Study for School!

  7. #17
    Join Date
    Apr 2007
    Beans
    14,781

    Re: Super basic python problem (I'm very new and trying to learn python)

    Quote Originally Posted by s3a View Post
    Well, I guess it is trying to show me how to run my programs regardless of where they are but, cding to directory alone should do it for me [atleast for now], right?
    Right.

  8. #18
    -grubby is offline May the Ubuntu Be With You!
    Join Date
    Aug 2007
    Beans
    Hidden!

    Re: Super basic python problem (I'm very new and trying to learn python)

    Quote Originally Posted by s3a View Post
    Well, I guess it is trying to show me how to run my programs regardless of where they are but, cding to directory alone should do it for me [atleast for now], right?
    I don't get why that wouldn't do it for you every time. If you wanted to run your programs from the command line with one word I assume you'd have to make an sh file in /usr/bin/

  9. #19
    Join Date
    Mar 2007
    Beans
    1,046

    Re: Super basic python problem (I'm very new and trying to learn python)

    Another thing I am not really getting:

    Note for Regular Expression Users
    Always use raw strings when dealing with regular expressions. Otherwise, a lot of backwhack-
    ing may be required. For example, backreferences can be referred to as '\\1' or r'\1'.

    I bolded what I don't get. for the first one, I keep thinking the \ makes the first ' diseappear and I am getting confused. Can someone clarify this for me please?
    Apps for Ubuntu (outdated) ---> http://cid-23a283fc1010a1bb.skydrive...%20Wine|6?uc=1
    Use Mnemosyne to Study for School!

  10. #20
    Join Date
    Apr 2007
    Beans
    14,781

    Re: Super basic python problem (I'm very new and trying to learn python)

    Quote Originally Posted by s3a View Post
    Another thing I am not really getting:

    Note for Regular Expression Users
    Always use raw strings when dealing with regular expressions. Otherwise, a lot of backwhack-
    ing may be required. For example, backreferences can be referred to as '\\1' or r'\1'.
    There are several ways of writing strings. A "raw" string is just that, a raw string. Nothing is interpreted.
    Code:
    x = "this\nis\nx\n\n"
    y = r"this\nis\nx\n\n"
    
    print x
    print y

Page 2 of 5 FirstFirst 1234 ... LastLast

Bookmarks

Posting Permissions

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