如何将给定的字符串转换为所需的字符串,如下面的Python所示

时间:2019-05-22 08:18:25

标签: python string

给出字符串:

p\u00e5 \u00e5rsbasis i marts.<br><br>P\u00e5 \u00e5rsbasis faldt industriproduktionen 0,6 procent (-0,3) mod analytikerkonsensus, der afventede et fald p\u00e5 0,8 procent.<br><br><table><tbody><tr><td>Eurozonen, %<\/td><td>marts, 2019<\/td><td>Konsensus<\/td><td>februar, 2019<\/td><\/tr><tr><td>Industriproduktion, YY<\/td><td>-0,6<\/td><td>-0,8<\/td><td>-0,3<\/td><\/tr><\/tbody><\/table>Konsensusdata

所需字符串:

på årsbasis i marts.<br><br>På årsbasis faldt industriproduktionen 0,6 procent (-0,3) mod analytikerkonsensus, der afventede et fald på 0,8 procent.<br><br><table><tbody><tr><td>Eurozonen, %</td><td>marts, 2019</td><td>Konsensus</td><td>februar, 2019</td></tr><tr><td>Industriproduktion, YY</td><td>-0,6</td><td>-0,8</td><td>-0,3</td></tr></tbody></table>Konsensusdata

1 个答案:

答案 0 :(得分:0)

您可以尝试:

string = b"p\u00e5 \u00e5rsbasis i marts.<br><br>P\u00e5 \u00e5rsbasis faldt industriproduktionen 0,6 procent (-0,3) mod analytikerkonsensus, der afventede et fald p\u00e5 0,8 procent.<br><br><table><tbody><tr><td>Eurozonen, %<\/td><td>marts, 2019<\/td><td>Konsensus<\/td><td>februar, 2019<\/td><\/tr><tr><td>Industriproduktion, YY<\/td><td>-0,6<\/td><td>-0,8<\/td><td>-0,3<\/td><\/tr><\/tbody><\/table>Konsensusdata"
print(string.decode('unicode_escape'))

输出:

  

'påårsbasisi marts。

Påårsbasisfaldt industriproduktionen 0,6 procent(-0,3)mod analytikerkonsensus,der afventede et faldpå0,8 procent。


/> Eurozonen,%<\ / td> marts,2019 <\ / td> Konsensus <\ / td> februar,2019 <\ / td> <\ / tr> Industriproduktion,YY <\ / td> -0,6 < \ / td> -0,8 <\ / td> -0,3 <\ / td> <\ / tr> <\ / tbody> <\ / table> Konsensusdata'