Python论坛  - 讨论区

标题:[python-chinese] 有没有将以逗号间隔的字符串转换为list类型的函数

2006年05月15日 星期一 12:51

邓作霖 pse-dengzl at pegasus.tj.cn
Mon May 15 12:51:36 HKT 2006

请问Python里有没有将以逗号间隔的若干单词组成的字符串转换为list类型的函 
数,谢谢。

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年05月15日 星期一 13:08

邓作霖 pse-dengzl at pegasus.tj.cn
Mon May 15 13:08:23 HKT 2006

初学Python,太强了,非常感谢。

imcs ee wrote:
> split(',')就可以了。
> In [1]: 'some,words,as,u,wish'.split(',')
> Out[1]: ['some', 'words', 'as', 'u', 'wish']
>
>
> On 5/15/06, *邓作霖* <pse-dengzl at pegasus.tj.cn
> pse-dengzl at pegasus.tj.cn>> wrote:
>
>     请问Python里有没有将以逗号间隔的若干单词组成的字符串转换为list类型的函
>     数,谢谢。
>     _______________________________________________
>     python-chinese
>     Post: send python-chinese at lists.python.cn
>     python-chinese at lists.python.cn>
>     Subscribe: send subscribe to
>     python-chinese-request at lists.python.cn
>     python-chinese-request at lists.python.cn>
>     Unsubscribe: send unsubscribe to
>     python-chinese-request at lists.python.cn
>     python-chinese-request at lists.python.cn>
>     Detail Info: http://python.cn/mailman/listinfo/python-chinese
>     <http://python.cn/mailman/listinfo/python-chinese>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年05月15日 星期一 13:58

imcs ee imcsee at gmail.com
Mon May 15 13:58:18 HKT 2006

split(',')就可以了。
In [1]: 'some,words,as,u,wish'.split(',')
Out[1]: ['some', 'words', 'as', 'u', 'wish']



On 5/15/06, 邓作霖 <pse-dengzl at pegasus.tj.cn> wrote:
>
> 请问Python里有没有将以逗号间隔的若干单词组成的字符串转换为list类型的函
> 数,谢谢。
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060515/aa2f1c85/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年05月15日 星期一 17:59

Andelf andelf at gmail.com
Mon May 15 17:59:48 HKT 2006

逗号间隔?? csv模块~

在06-5-15,邓作霖 <pse-dengzl at pegasus.tj.cn> 写道:
>
> 初学Python,太强了,非常感谢。
>
> imcs ee wrote:
> > split(',')就可以了。
> > In [1]: 'some,words,as,u,wish'.split(',')
> > Out[1]: ['some', 'words', 'as', 'u', 'wish']
> >
> >
> > On 5/15/06, *邓作霖* <pse-dengzl at pegasus.tj.cn
> > pse-dengzl at pegasus.tj.cn>> wrote:
> >
> >     请问Python里有没有将以逗号间隔的若干单词组成的字符串转换为list类型的函
> >     数,谢谢。
> >     _______________________________________________
> >     python-chinese
> >     Post: send python-chinese at lists.python.cn
> >     python-chinese at lists.python.cn>
> >     Subscribe: send subscribe to
> >     python-chinese-request at lists.python.cn
> >     python-chinese-request at lists.python.cn>
> >     Unsubscribe: send unsubscribe to
> >     python-chinese-request at lists.python.cn
> >     python-chinese-request at lists.python.cn>
> >     Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >     <http://python.cn/mailman/listinfo/python-chinese>
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
Andelf
BLOG:http://blog.sohu.com/members/andelf/
BLOG:http://spaces.msn.com/members/andelf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060515/4209fe05/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号