I need to parse byte string which spans more than one line in the source code. Like this
self.file.write(b'#compdef %s\n\n'
'_arguments -s -A "-*" \\\n' % (self.cmdName,))
this line throws the following exception
builtins.SyntaxError: cannot mix bytes and nonbytes literals
which can be fixed in the following way
self.file.write(b'#compdef %s\n\n\'\'_arguments -s -A "-*" \\\n' % (self.cmdName,))
Notice the backslashes after \n
. but this fix does the follow the project rules of less than 79 characters per line.
How do I fix this?
The code works fine on Python 2 but fails on Python 3.