Line is too long. Django PEP8

It’s “correct”, PEP8 just flags lines over 79 characters long. But if you’re concerned about that, you could write it like this: Or this: Or, really, any other style that would break the single line into multiple shorter lines.

Python how to write to a binary file?

This is exactly what bytearray is for: If you’re using Python 3.x, you can use bytes instead (and probably ought to, as it signals your intention better). But in Python 2.x, that won’t work, because bytes is just an alias for str. As usual, showing with the interactive interpreter is easier than explaining with text, … Read more

How to print both strings in a dictionary in Python

Your problem is that you need to use square brackets([]) instead of parenthesis(()). Like so: But I recommend using the .items()( that would be .iteritems() if your using Python 2.x) attribute of dicts instead: Thanks to @PierceDarragh for mentioning that using .format() would be a better option for your string formatting. eg. Or, as @ShadowRanger … Read more