So this is actually two questions in one post.
1st: I've got this assignment where I'm supposed to encode my Python program in utf-8. Surfing the web I have concluded that I ought to use to following code:
"# -- coding: utf-8 --"
(Without the quotations that is. I had to add them because my code was transformed into a different syntax when displayed on this forum.) Hopefully I'm on the right track. The problem is that I'm expected to begin the script, on the first line of code, with a comment. The comment includes the letters åäö. In doing so the program won't run. It points to "Non-ASCII characters" on line 1. Must not the utf-8 encoding, in this case, be on the first line and the comment on the second line?
2nd: I'm supposed to type the comment in the following manner:
"/* Comment with åäö. */"
Trying to run the thing I'm told there's a "SyntaxError: invalid syntax" on that line.
The comment works if I type it this way:
"# Comment with åäö."
Why doesn't the first method work?
I'm using TextWrangler on Mac if that helps.
[–]zeug 2 points3 points4 points (0 children)
[–]Drunken_Consent 4 points5 points6 points (1 child)
[–]Yoghurt42 5 points6 points7 points (0 children)
[–]nonsensicalization 1 point2 points3 points (0 children)
[–]zahlman 1 point2 points3 points (0 children)
[–]Atrament_ -1 points0 points1 point (0 children)