Python论坛  - 讨论区

标题:Re: Re: [python-chinese]如何把字符串中按空格分开的元素分别提取出来?

2005年09月05日 星期一 16:36

张娟 liwapple at 163.com
Mon Sep 5 16:36:55 HKT 2005

看帮助吧!help(str)
或者dir(str),然后具体看某个方法的.__doc__, 
eg:
>>> str.split.__doc__
'S.split([sep [,maxsplit]]) -> list of strings\n\nReturn a list of the words in the string S, using sep as the\ndelimiter string.  If maxsplit is given, at mo
st maxsplit\nsplits are done. If sep is not specified or is None, any\nwhitespace string is a separator.'

----- Original Message ----- 
From: "广星" <guangxing at ict.ac.cn>
To: "limodou at gmail.com, python-chines" <limodou at gmail.com,python-chinese at lists.python.cn>
Sent: Monday, September 05, 2005 4:16 PM
Subject: Re: Re: [python-chinese]如何把字符串中按空格分开的元素分别提取出来?


> 天阿,
> limodou,
> 你也太快、太牛了吧!!!!!!!!!!!
> 果然可以了!
> 
> 恩,敬仰之余,
> 想要那只点石成金的手指!
> limodou大师,可否告知,
> 这些方法之类的您是怎么来查,又从哪里来查到呢?
> 
> ======= 2005-09-05 16:10:24 您在来信中写道:=======
> 
> >在 05-9-5,广星<guangxing at ict.ac.cn> 写道:
> >> 感觉python中用于字符串连接的方法似乎非常的多,
> >> 可是,对于字符串提取的方法好像不是很多哦。
> >> 
> >> 现在遇到一个小问题,想请教大家。
> >> 
> >> 比如字符串如下:
> >> "1 23"或者"2 bazaari"
> >> 现在想跳过空格前的那个元素和空格,提取出23或者bazaari来,
> >> 应用python怎么才可以做到呢?
> >> 
> >
> >"1 23".split(" ", 1)[1]
> >
> >-- 
> >I like python! 
> >My Donews Blog: http://www.donews.net/limodou
> >_______________________________________________
> >python-chinese list
> >python-chinese at lists.python.cn
> >http://python.cn/mailman/listinfo/python-chinese
> >
> 
> = = = = = = = = = = = = = = = = = = = =
> 
> 
>         致
> 礼!
>  
> 
>         广星
>         guangxing at ict.ac.cn
>           2005-09-05
> 
> 


--------------------------------------------------------------------------------


> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
> 

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

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

    你的回复:

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

    Zeuux © 2025

    京ICP备05028076号