Попытка объединить этот список строк Unicode - PullRequest
2 голосов
/ 01 августа 2011

Попытка объединить этот список строк Unicode.Я пробовал как с использованием суммы, а также с помощью соединения.Не повезло.

Есть идеи, как мне это сделать?Я просто хочу вывод простого текста всех этих строк в виде одной большой строки.

[u'\nPanera Bread (NASDAQ: <a class="ticker" href="/stock/pnra#NASDAQ">PNRA</a>) is down 6 percent today over expectations of food inflation of 4.5% in Q3 and 5% for Q4. In addition, Panera Will Raise Menu Prices in Q4.',
 u'\nPNRA recently posted second quarter 2011 earnings of $1.18 per share. Reported earnings also outpaced the prior-year quarter earnings of 85 cents per share. ',
 u"\nBut shares were also lower ahead of the opening bell after the company reported weaker-than-expected same-store sales figures for its recent quarter late Tuesday. Its profit of $1.18 a share topped analysts' consensus call by a penny.",
 u'\nFor the twenty-six weeks ended June 28, 2011, net income was $68 million, or $2.27 per diluted share. These results compare to net income of $53 million, or $1.67 per diluted share, for the twenty-six weeks ended June 29, 2010, and represent a 36% year-over-year increase in diluted earnings per share.\n']

Ответы [ 3 ]

9 голосов
/ 01 августа 2011

Использовать unicode.join.

u''.join(that_list)
1 голос
/ 01 августа 2011

Я пробовал использовать как сумму, так и соединение. Не повезло.

''.join(the_list) отлично работает для меня.

0 голосов
/ 01 августа 2011

Может быть, это то же самое, но с заменой

''.join(ur_list).replace('\n','')
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...