Python:\ n没有按预期工作

时间:2015-08-04 05:36:46

标签: python python-2.7 newline

我尝试在下面的代码中格式化一些数据,但我的第二个\n无法识别,因此我没有为正文中包含的内容获取新行。

关于为什么会发生这种情况的任何解释?

#!/usr/bin/env python
import json
import requests
import datetime
import sys

OAUTH_KEY = "xxxxxxxxxxxxxxxxxxxx"
repos = ['my-app']

# List pull request
def list_pr():
    for repo in repos:
        r = requests.get('https://api.github.com/repos/davanand/%s/pulls' % repo, auth=('token', OAUTH_KEY))
        data = r.json()

        for i in data:
            print i['user']['login'] + '\n' + i['title'] + '\n' + i['body']

list_pr()

0 个答案:

没有答案