我该如何更改文本分隔符 [英] how can i change the text delimiter

查看:65
本文介绍了我该如何更改文本分隔符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



有人可以告诉我如何更改FastCSV解析器中的文本分隔符



默认情况下,文本分隔符为double引号(")

我想将它更改为其他任何东西......说一个烟斗(|)..

任何人都可以告诉我我该怎么办?它?

Hi,
Can anybody tell me how to change the text delimiter in FastCSV Parser
?
By default the text delimiter is double quotes(")
I want to change it to anything else... say a pipe (|)..
can anyone please tell me how do i go about it?

推荐答案

sonald< so ******* @ gmail.comwrote:
sonald <so*******@gmail.comwrote:



有人能告诉我如何更改FastCSV解析器中的文本分隔符



By默认文本分隔符是双引号(")

我想将其更改为其他任何内容...说一个管道(|)..

任何人都可以告诉我该怎么办呢?
Hi,
Can anybody tell me how to change the text delimiter in FastCSV Parser
?
By default the text delimiter is double quotes(")
I want to change it to anything else... say a pipe (|)..
can anyone please tell me how do i go about it?



您可以使用解析器构造函数指定字段分隔符:

Python>>解析器(ms_double_quote = 1,field_sep ='','',auto_clear = 1)


欢呼,

amit。


-

----

Amit Khemka - onyomo.com

主页: www.cse.iitd.ernet.in/~csd00377

无尽的世界轮回,无尽的太阳旋转,无尽的追求;

我再次转身,回到我自己的开始,在这里,找到休息。

You can use the parser constructor to specify the field seperator:
Python >> parser(ms_double_quote = 1, field_sep = '','', auto_clear = 1)

cheers,
amit.

--
----
Amit Khemka -- onyomo.com
Home Page: www.cse.iitd.ernet.in/~csd00377
Endless the world''s turn, endless the sun''s Spinning, Endless the quest;
I turn again, back to my own beginning, And here, find rest.


2006年8月30日,Amit Khemka< kh ******** @ gmail.comwrote:
On 8/30/06, Amit Khemka <kh********@gmail.comwrote:

sonald< so ******* @ gmail.comwrote:
sonald <so*******@gmail.comwrote:



任何人都可以告诉我如何改变FastCSV解析器中的文本分隔符



默认情况下,文本分隔符是双引号(")

我想将其更改为任何内容别...说管道(|)..
Hi,
Can anybody tell me how to change the text delimiter in FastCSV Parser
?
By default the text delimiter is double quotes(")
I want to change it to anything else... say a pipe (|)..



B tw,我忘了提到AFAIK,用CSV'''''(双引号)是

*不是*字段分隔符分隔字符!


'',''(逗号)是默认的字段分隔符,我之前的建议

正在考虑你要更改

字段分隔符的默认值。 > http://en.wikipedia.org/wiki /逗号分隔值


欢呼,

amit。

-

----

Amit Khemka - onyomo.com

主页: www.cse.iitd.ernet.in/~csd00377

无尽的世界,无尽的阳光'' s旋转,无尽的追求;

我再次转向,回到我自己的开始,在这里,找到休息。

Btw, I forgot to mention that AFAIK, in CSV ''"'' (double quotes) are
*not* field seperator delimiters character !

'','' (comma) is the default field seperator, and my earlier suggestion
was considering that you want to change the default value for the
field seperator.

http://en.wikipedia.org/wiki/Comma-separated_values

cheers,
amit.
--
----
Amit Khemka -- onyomo.com
Home Page: www.cse.iitd.ernet.in/~csd00377
Endless the world''s turn, endless the sun''s Spinning, Endless the quest;
I turn again, back to my own beginning, And here, find rest.


嗨Amit,

感谢您的快速回复...

例如记录是:askinem"


整个文本被提取为一个字符串,但由于限定符是

双引号("),因此fastcsv解析器无法解析它。


如果我们可以将文本限定符更改为pipe(|),那么字符串将

看起来像这样:

| askin" em |


但是为此,fastcsv解析器中的默认文本限定符需要

更改为管道(|)。怎么做?


另请注意,字符串根本无法修改。谢谢。

Amit Khemka写道:
Hi Amit,
Thanks for a quick response...
E.g record is: "askin"em"

This entire text is extracted as one string but since the qualifier is
double quotes("), therefore fastcsv parser is unable to parse it.

If we can change the text qualifier to pipe(|), then the string will
look like this:
|askin"em|

But for this the default text qualifier in fastcsv parser needs to be
changed to pipe(|). how to do this?

Also please note that the string cannot be modified at all. Thanks.
Amit Khemka wrote:

sonald< so ******* @ gmail.comwrote:
sonald <so*******@gmail.comwrote:



有人能告诉我如何更改FastCSV解析器中的文本分隔符



默认情况下,文本分隔符是双引号(")

我想将其更改为其他任何内容...说管道(|)..

can有人请告诉我我该怎么办?
Hi,
Can anybody tell me how to change the text delimiter in FastCSV Parser
?
By default the text delimiter is double quotes(")
I want to change it to anything else... say a pipe (|)..
can anyone please tell me how do i go about it?



您可以使用解析器构造函数来指定字段分隔符:

Python>>解析器(ms_double_quote = 1,field_sep ='','',auto_clear = 1)


欢呼,

amit。


-

----

Amit Khemka - onyomo.com

主页: www.cse.iitd.ernet.in/~csd00377

无尽的世界轮回,无尽的太阳旋转,无尽的追求;

我再次转身,回到我自己的开始,在这里,找到休息。


You can use the parser constructor to specify the field seperator:
Python >> parser(ms_double_quote = 1, field_sep = '','', auto_clear = 1)

cheers,
amit.

--
----
Amit Khemka -- onyomo.com
Home Page: www.cse.iitd.ernet.in/~csd00377
Endless the world''s turn, endless the sun''s Spinning, Endless the quest;
I turn again, back to my own beginning, And here, find rest.


这篇关于我该如何更改文本分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆