How can I break up this long line in Python?

后端 未结 5 2060
忘了有多久
忘了有多久 2020-11-27 10:03

How would you go about formatting a long line such as this? I\'d like to get it to no more than 80 characters wide:

logger.info(\"Skipping {0} because its th         


        
5条回答
  •  眼角桃花
    2020-11-27 10:22

    Consecutive string literals are joined by the compiler, and parenthesized expressions are considered to be a single line of code:

    logger.info("Skipping {0} because it's thumbnail was "
      "already in our system as {1}.".format(line[indexes['url']],
      video.title))
    

提交回复
热议问题