How to break long string lines for PEP8 compliance?

Houman picture Houman · Sep 20, 2014 · Viewed 16.5k times · Source

I have many long lines like this in the project and don't know how to break it to keep PEP8 happy. PEP8 shows warning from .format(me['id'])

pic_url = "http://graph.facebook.com/{0}/picture?width=100&height=100".format(me['id'])

How can I break the line to get rid of PEP8 warning and yet don't break the code?

Answer

falsetru picture falsetru · Sep 20, 2014

Using string literal concatenation:

pic_url = ("http://graph.facebook.com/{0}/"
           "picture?width=100&height=100".format(me['id']))