【发布时间】:2014-02-28 09:02:00
【问题描述】:
如何在 Python 中用逗号分割字符串,其中包含逗号本身?假设字符串是:
object = """{"alert", "Sorry, you are not allowed to do that now, try later", "success", "Welcome, user"}"""
如何确保拆分后只得到四个元素?
【问题讨论】:
-
object = {和}是否也包含在字符串中? -
只有 {}。但我可以轻松剥离它们。