How to add comments to multiline assignments in python, as is possible in C with the syntax:
char sc[] = "\x31\xdb" /* xor %ebx, %ebx */
"\x31\xc9" /* xor %ecx, %ecx */
"\xb8\x46\x00\x00\x00" /* mov $0x46, %eax */
"\xcd\x80" /* int $0x80 */
"\x31\xdb" /* xor %ebx, %ebx */
"\xb8\x01\x00\x00\x00" /* mov $0x1, %eax */
"\xcd\x80"; /* int $0x80 */
but the same in python, using escaped line breaks
sc = "\x31\xdb" \ # xor %ebx, %ebx
"\x31\xc9" \ # xor %ecx, %ecx
"…"
To comment out multiple lines in Python, you can prepend each line with a hash ( # ). With this approach, you're technically making multiple single-line comments.
To implement multi line comments using # sign, we can simply depict each line of a multi line comment as a single line comment. Then we can start each line by using # symbol and we can implement multi line comments.
You can write
sc = ("\x31\xdb" # xor %ebx, %ebx
"\x31\xc9" # xor %ecx, %ecx
"…")
if you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With