Pep8 E501: line too long error

前端 未结 3 2248
说谎
说谎 2021-01-04 05:26

I get the error E501: line too long from this code:

header, response = client.request(\'https://api.twitter.com/1.1/statuses   /user_timeline.js         


        
3条回答
  •  既然无缘
    2021-01-04 06:21

    The whitespaces at the beginning of the lines become part of your string if you break it like this.

    Try this:

    header, response = client.request(
       'https://api.twitter.com/1.1/statuses/user_timeline.'
       'json?include_entities=true&screen_name=' + username + '&count=1')
    

    The strings will automatically be concatenated.

提交回复
热议问题