我正在使用 Python SQLAlchemy cx_Oracle。我正在存储这样的字符串
"1 Some Road\nSome Place\nSome City"
进入 db.Text 字段。但是在保存它之后,我得到的是:
"1 Some RoadSome PlaceSome City"
那么,你知道谁吃了我的“\n”吗?请帮帮我
这是我在 Python 中定义模型的方式:
class Object(db.Model):
id = db.Column(db.Integer, primary_key=True)
address = db.Column(db.Text(100))
这是我保存它的方法:
o = Object(address=""1 Some Road\nSome Place\nSome City")
db.session.add(o)
db.session.commit()
之后,当我拥有它时, o.address 是:
"1 Some RoadSome PlaceSome City"
干杯