I have some python code. In order to shorten the rest of the script, I have placed all the values into something like this:
Data = 14,14,14,14,14,14,14,14,14,14,14,14
This is of course, hard to read, so I then wanted to add comments.
Data = 14,14,14 #1 14,14,14 #2 14,14,14 #3 14,14,14 #4
This of course did not work, as the comments commented out everything else. So I wanted to do this:
Data =
14,14,14, #1
14,14,14, #2
14,14,14, #3
14,14,14, #4
This gives me a SyntaxError. Does anyone know if this is possible? And if so, how to do it? Thanks!
Use parens to break statements up over multiple lines:
Data = (
14, 14, 14, # 1
14, 14, 14, # 2
14, 14, 14, # 3
14, 14, 14, # 4
)
Note that you can multiply tuples; if 1 thru 4 are identical, it's simpler IMO to write:
Data = (14, 14, 14) * 4 # 1 thru 4
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments