我有这张表格的数据
34950388,"Bodycology Scarlet Kiss Fragrance Mist, 8 fl oz","<p>Turn heads
with our intoxicating fragrance made with rich pomegranate, luscious peach
and warm vanilla. Be confident, and you're sure to be a showstopper!
</p>","<B>Bodycology Scarlet Kiss Fragrance Mist, 8 fl oz:</b><ul><li>For
a splash of fragrance and energy, spritz lightly on wrists, neck and
shoulders.<li>Top Notes: Juicy Pomegranate, Peach Skin, Macintosh
Apple<li>Middle Notes: Red Peony, Osmanthus, Marshmallow Creme<li>Dry
Notes: Rich, Vanilla Rum, Oakwood, Scarlet Musk</ul>",None,,
我想读取此数据并根据文本中的逗号将其拆分,以便拆分后的输出为:
34950388
"Bodycology Scarlet Kiss Fragrance Mist, 8 fl oz"
"<p>Turn heads with our intoxicating fragrance made with rich
pomegranate, luscious peach and warm vanilla. Be confident, and you're
sure to be a showstopper!</p>"
"<B>Bodycology Scarlet Kiss Fragrance Mist, 8 fl oz:</b><ul><li>For
a splash of fragrance and energy, spritz lightly on wrists, neck and
shoulders.<li>Top Notes: Juicy Pomegranate, Peach Skin, Macintosh
Apple<li>Middle Notes: Red Peony, Osmanthus, Marshmallow Creme<li>Dry
Notes: Rich, Vanilla Rum, Oakwood, Scarlet Musk</ul>"
None
不使用Python中的任何库(Numpy,Pandas),我如何做到这一点?你知道吗
可以使用regex按逗号拆分,而不是用引号括起来:
假设您的数据是
text
,那么使用re
模块和re.split
:输出:
相关问题 更多 >
编程相关推荐