Reputation: 40623
I'm lost in Python world:
message = struct.pack('B', 4) +
minissdpdStringEncode(st) +
minissdpdStringEncode(usn) +
minissdpdStringEncode(server) +
minissdpdStringEncode(location)
It doesn't run. Do I really need to put this all on one line or something?
That would be messy in my opinion.
Upvotes: 3
Views: 455
Reputation: 184101
Add a backslash (\) at the end of each line of the statement except the last.
Upvotes: 2
Reputation: 992887
You have two choices:
message = struct.pack('B', 4) + \
minissdpdStringEncode(st)
or
message = (struct.pack('B', 4) +
minissdpdStringEncode(st))
I usually find the second form with parentheses easier to read.
Upvotes: 8
Reputation: 37899
You can continue a line by ending it with a backslash \
:
message = struct.pack('B', 4) + \
minissdpdStringEncode(st) + \
minissdpdStringEncode(usn) + \
minissdpdStringEncode(server) + \
minissdpdStringEncode(location)
Upvotes: 2