Need help with programming.
jwilhelm at outsourcefinancial.com
Thu Oct 25 02:02:46 CEST 2001
> Hello. I've just begun using Python, and am now getting into
> simple commands.
> Everytime I try to use "else:" I get this message:
> SyntaxError: invalid syntax
> I've tried retyping it, skipping it, etc. but it's really
> bothering me... is
> there an alternative I can use for "else:" such as "or:"...
> Or am I typing it
> wrong, or something? I tried browsing a few webpage's a bit,
> to hopefully find
> an answer to my question, but I didnt find anything to help
> me out. Any help
> would be very much appreciated. Thank you.
Well, my suggestion on this would be to check your indentation level. Keep
in mind that the "else:" line needs to be at the same indentation level as
the "if ...:" line. So for instance, your code should look like this:
Whereas, if you have this:
That will just break, and probably give the error you're saying.
Hope that helps.
More information about the Python-list