再版(串) [英] repr(string)
问题描述
我一直在每个字段一行保存数据。
现在有些字段可能会成为多行字符串...
当我意识到repr()和eval()应该
时,我正准备开始逃避和无线换行
。因此问题:如果s是一个字符串,那么repr(s)
保证不包含换行符吗?
-
David C. Ullrich
I''ve been saving data in a file with one line per field.
Now some of the fields may become multi-line strings...
I was about to start escaping and unescaping linefeeds
by hand, when I realized that repr() and eval() should
do. Hence the question: If s is a string, is repr(s)
guaranteed not to contain line breaks?
--
David C. Ullrich
推荐答案
2008年7月23日星期三下午12:04,David C. Ullrich< du *** ***@sprynet.comwrote:
On Wed, Jul 23, 2008 at 12:04 PM, David C. Ullrich <du******@sprynet.comwrote:
我已经将数据保存在每个字段一行的文件中。
现在一些这些字段可能会变成多行字符串...
当我意识到repr时,我正准备开始逃避和无线换行
)和eval()应该
。因此问题:如果s是一个字符串,那么repr(s)
保证不包含换行符?
I''ve been saving data in a file with one line per field.
Now some of the fields may become multi-line strings...
I was about to start escaping and unescaping linefeeds
by hand, when I realized that repr() and eval() should
do. Hence the question: If s is a string, is repr(s)
guaranteed not to contain line breaks?
在引用换行符的意义上?是的,repr就是这样。
In the sense that line breaks are quoted ? Yes, repr does that.
>
-
David C. Ullrich
-
http:// mail。 python.org/mailman/listinfo/python-list
-
- Guilherme H. Polo Goncalves
--
-- Guilherme H. Polo Goncalves
David C. Ullrich写道:
David C. Ullrich wrote:
我一直在将数据保存在一个文件中每个字段一行。
现在有些字段可能会成为多行字符串...
我即将开始转义和转义换行符/>
手工,当我意识到repr()和eval()应该
时。因此问题:如果s是一个字符串,那么repr(s)
保证不包含换行符?
I''ve been saving data in a file with one line per field.
Now some of the fields may become multi-line strings...
I was about to start escaping and unescaping linefeeds
by hand, when I realized that repr() and eval() should
do. Hence the question: If s is a string, is repr(s)
guaranteed not to contain line breaks?
是的。
请记住,对不受信任的数据使用eval()并不是很好/>
想法。
< / F>
yes.
just keep in mind that using eval() on untrusted data isn''t a very good
idea.
</F>
在文章< ma * ***********************************@python.org> ;,
Fredrik Lundh< fr ***** @ pythonware.comwrote:
In article <ma************************************@python.org >,
Fredrik Lundh <fr*****@pythonware.comwrote:
David C. Ullrich写道:
David C. Ullrich wrote:
我已经将数据保存在每个字段一行的文件中。
现在有些字段可能会成为多行字符串...
当我意识到repr()和eval()应该
时,我正准备开始逃避和无线换行
。因此问题:如果s是一个字符串,那么repr(s)
保证不包含换行符?
I''ve been saving data in a file with one line per field.
Now some of the fields may become multi-line strings...
I was about to start escaping and unescaping linefeeds
by hand, when I realized that repr() and eval() should
do. Hence the question: If s is a string, is repr(s)
guaranteed not to contain line breaks?
是的。
请记住,对不受信任的数据使用eval()并不是很好/>
想法。
yes.
just keep in mind that using eval() on untrusted data isn''t a very good
idea.
对。这些数据来自我,被放入一个文件然后
由我读。有人_could_腐败了那个文件,但是那个可以做到这一点的人可以更容易地把机器扔出来
窗口......
Right. This data comes from me, gets put into a file and then
read by me. Someone _could_ corrupt that file, but someone who
could do that could more easily just throw the machine out
the window...
< / F>
</F>
-
David C. Ullrich
--
David C. Ullrich
这篇关于再版(串)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!