2005年07月11日 星期一 11:28
def a(*args): print type(args) for i in args: print "i = ", i a(3,4,5,6,7,8)i = 3 i = 4 i = 5 i = 6 i = 7 i = 8 Qutr , qutianrang at gmail.com 2005-7-11 ----- 收到以下来信内容 ----- 发件人: guqi 收件人: limodou,python-chinese 时 间: 2005-07-11, 11:21:54 主 题: Re: [python-chinese] 如何写出具有可变参数的函数 给个例子先.. ----- Original Message ----- From: "limodou" <limodou at gmail.com> To: <python-chinese at lists.python.cn> Sent: Monday, July 11, 2005 10:56 AM Subject: Re: [python-chinese] 如何写出具有可变参数的函数 > *args是任意长的参数。 > > 在 05-7-11,guqi<guqi at oasisnet.com.cn> 写道: > > 有人提供用*args,这是如何使用的呢. > > > > ----- Original Message ----- > > From: "梅劲松" <stephen.cn at gmail.com> > > To: <python-chinese at lists.python.cn> > > Sent: Monday, July 11, 2005 9:30 AM > > Subject: Re: [python-chinese] 如何写出具有可变参数的函数 > > > > > > > 建议使用 > > > 用缺省函数: > > > > > > def func(a, b=1, c=2): > > > print a, b, c > > > > > > func(5) 输出 5 1 2 > > > func(5, 3) 输出 5 3 2 > > > func(5, 3, 4) 输出 5 3 4 > > > > > > 这样的做法。 > > > > > > 在 05-7-11,Qiangning Hong<hongqn at gmail.com> 写道: > > > > 用缺省函数: > > > > > > > > def func(a, b=1, c=2): > > > > print a, b, c > > > > > > > > func(5) 输出 5 1 2 > > > > func(5, 3) 输出 5 3 2 > > > > func(5, 3, 4) 输出 5 3 4 > > > > > > > > > > > > 用不定长参数列表 > > > > > > > > def func(a, *args): > > > > print a, args > > > > > > > > func(5) 输出 5 () > > > > func(5, 3) 输出 5 (3,) > > > > func(5, 3, 4) 输出 5 (3, 4) > > > > > > > > > > > > guqi wrote: > > > > > 给个简单一点的例子. > > > > > > > > > > ----- Original Message ----- > > > > > From: "Qiangning Hong" <hongqn at gmail.com> > > > > > To: <python-chinese at lists.python.cn> > > > > > Sent: Friday, July 08, 2005 5:43 PM > > > > > Subject: Re: [python-chinese] 如何写出具有可变参数的函数 > > > > > > > > > > > > > > > > > > > >>On 7/8/05, guqi <guqi at oasisnet.com.cn> wrote: > > > > >> > > > > >>> > > > > >>>例如: > > > > >>>定义时func(a,b,c) > > > > >>> > > > > >>>调用时func(a)或func(a,b)呢. > > > > >> > > > > >>用缺省参数或者不定长参数列表 > > > > >>请看python自带的教程里4.7节"More on Defining Functions" > > > > >>http://www.python.org/doc/2.4.1/tut/node6.html#SECTION006700000000000000000 > > > > >> > > > > >>-- > > > > >>Qiangning Hong > > > > >> > > > > >>I'm usually annoyed by IDEs because, for instance, they don't use VIM > > > > >>as an editor. Since I'm hooked to that, all IDEs I've used so far have > > > > >>failed to impress me. > > > > >> -- Sybren Stuvel @ c.l.python > > > > >> > > > > >>Get Firefox! <http://www.spreadfirefox.com/?q=affiliates&id;=67907&t;=1> > > > > >> > > > > > > > > > > > > > > > -------------------------------------------------------------------------------- > > > > > > > > > > > > > > > > > > > >>_______________________________________________ > > > > >>python-chinese list > > > > >>python-chinese at lists.python.cn > > > > >>http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > -- > > > > Qiangning > > > > _______________________________________________ > > > > python-chinese list > > > > python-chinese at lists.python.cn > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > -- > > > 梅劲松 > > > > > > > > > -------------------------------------------------------------------------------- > > > > > > > _______________________________________________ > > > python-chinese list > > > python-chinese at lists.python.cn > > > http://python.cn/mailman/listinfo/python-chinese > > > > > _______________________________________________ > > python-chinese list > > python-chinese at lists.python.cn > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > -- > I like python! > My Donews Blog: http://www.donews.net/limodou > New Google Maillist: http://groups-beta.google.com/group/python-cn > -------------------------------------------------------------------------------- > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > _______________________________________________ python-chinese list python-chinese at lists.python.cn http://python.cn/mailman/listinfo/python-chinese -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050711/4f55a2b1/attachment.html
2005年07月11日 星期一 11:34
那还等什么,从这周开始,找一项你喜欢的运动,坚持三个月,看看疗效如何 可以让你睡的更少但精力充沛,吃的不多但身体健康 在上海对轮滑有兴趣的朋友(从零基础到轮滑高手),愿意的话可以来找我一起玩 从十多岁到三十多岁,我们的成员团结乐观,让我们大家一起做运动:) -----原始邮件----- 发件人: python-chinese-bounces at lists.python.cn [mailto:python-chinese-bounces at lists.python.cn]代表 Neo Chan (netkiller) 发送时间: 2005年7月11日 11:03 收件人: python-chinese at lists.python.cn 主题: RE: [python-chinese] 抬起头,看看你周围的朋友,同事.. """ 多做户外运动,多玩年轻人的时尚的运动,比如街舞,轮滑 google的人还喜欢穿着轮滑鞋打hocky呢 """ re:Liming_Do 你上面的一句话,我分析了一下.挺精典."多玩年轻人" 我发现我有亚键康问题... Neo Chan (netkiller) Best Regards, 73! de BG7NYT Amateur Radio Callsign: BG7NYT _____ From: python-chinese-bounces at lists.python.cn [mailto:python-chinese-bounces at lists.python.cn] On Behalf Of Liming_Do Sent: Monday, July 11, 2005 10:50 AM To: python-chinese at lists.python.cn Subject: 答复: [python-chinese] 抬起头,看看你周围的朋友,同事.. 多做户外运动,多玩年轻人的时尚的运动,比如街舞,轮滑 google的人还喜欢穿着轮滑鞋打hocky呢 -----原始邮件----- 发件人: python-chinese-bounces at lists.python.cn [mailto:python-chinese-bounces at lists.python.cn]代表 Neo Chan (netkiller) 发送时间: 2005年7月11日 10:42 收件人: python-chinese at lists.python.cn 主题: [python-chinese] 抬起头,看看你周围的朋友,同事.. 不知大家有没有发现..中国人活的太累... 每个人,每天都精神不振,迷迷糊糊的..???为什么??? 常常在工作时间打盹。 出去上马路上看看其它人..也一样..一个个没精打彩的..低头走路.. 都好像有病一样..(哈哈:东亚病夫) 我自己也是一样..天天睡眠不足.. 你在看看身边的老外,很精神.工作也是精力充沛.为什么呢??? Neo Chan (netkiller) Best Regards, 73! de BG7NYT Amateur Radio Callsign: BG7NYT -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050711/e41826bd/attachment.htm
Zeuux © 2025
京ICP备05028076号