I have a question that may be straight forward, or may be impossible to answer, I’m not sure. I’m wondering how I can define a color in python.
For example, I would like to simply do this:
myColor = #920310
However, using the ‘#’ sign in python automatically comments anything following.
Is there a way around this? Thank you and sorry if this question is very simple
If you want it as a string, do
If you actually want it to be a
Colorobject, you can do something likeand interpret it in
Color‘s constructor.If the question is can you make
#not be interpreted as a comment, then the answer is no. If#wasn’t a comment, it wouldn’t be Python any more.You could define your own, Python-like language where a
#after an=wouldn’t mean a comment (since that’s not valid Python anyway) and it wouldn’t break any code, but you wouldn’t be able to use the#syntax elsewhere without breaking code.