How to break long string lines for PEP8 compliance? [duplicate]

强颜欢笑 提交于 2019-12-10 00:45:50

问题


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?


回答1:


Using string literal concatenation:

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


来源:https://stackoverflow.com/questions/25949525/how-to-break-long-string-lines-for-pep8-compliance

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!