【发布时间】:2013-11-08 19:22:53
【问题描述】:
我正在使用 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"
干杯
【问题讨论】:
-
这可能是它在您的客户端中的表示方式,但不一定是它在数据库中的存储方式...
-
我在字段上使用 SQLdeveloper 进行了检查。我也找不到“\n”。
标签: python oracle unicode sqlalchemy