#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Location
    temporarly: Rosetown, Sk (Canada)
    Posts
    22
    Rep Power
    0

    Syntax Error in simple string comparison


    What is wrong with this code?
    Code:
    Source = raw_input("File's path: C:/")
    If Source[0:3] == 'C:/':
        print 'Invalid path'
    This is actually just thought to take the path of a file, and then make sure, that 'C:/' is not entered twice.
    When I try to run it though, I am getting an error message at the variable 'Source', which is marked as invalid syntax. Why???
    thanx
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    You are using a capital letter in your if keyword, this is significant because Python is case sensitive .

    Mark.
    programming language development: www.netytan.com Hula


IMN logo majestic logo threadwatch logo seochat tools logo