2007年04月08日 星期日 17:41
Hi, 有一个 a list: [2,5,8,0,1,7], 如何用同样的元素随机产生新的list 如: [5,2,8,0,1,7] [8,0,7,1,5,2] 多谢!!! Linda
2007年04月08日 星期日 17:53
貌似random.sample正好满足你的需要 import random a = [2,5,8,0,1,7] random.sample(a, len(a)) 2007/4/8, linda. s <samrobertsmith at gmail.com>: > > Hi, > 有一个 a list: [2,5,8,0,1,7], > 如何用同样的元素随机产生新的list > 如: > [5,2,8,0,1,7] > [8,0,7,1,5,2] > 多谢!!! > Linda > _______________________________________________ > 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://python.cn/pipermail/python-chinese/attachments/20070408/cd20ac62/attachment.html
2007年04月08日 星期日 22:20
random.shuffle 2007/4/8, linda. s <samrobertsmith在gmail.com>: > Hi, > 有一个 a list: [2,5,8,0,1,7], > 如何用同样的元素随机产生新的list > 如: > [5,2,8,0,1,7] > [8,0,7,1,5,2] > 多谢!!! > Linda > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese
2007年04月09日 星期一 08:51
是的。这个函数可以。我刚想回复呢。呵呵 在2007-04-08,"东子" <hydonlee at gmail.com> 写道: 貌似random.sample正好满足你的需要 import random a = [2,5,8,0,1,7] random.sample(a, len(a)) 2007/4/8, linda. s <samrobertsmith at gmail.com >:Hi, 有一个 a list: [2,5,8,0,1,7], 如何用同样的元素随机产生新的list 如: [5,2,8,0,1,7] [8,0,7,1,5,2] 多谢!!! Linda _______________________________________________ python-chinese Post: sendpython-chinese at lists.python.cn Subscribe: send subscribe topython-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://python.cn/pipermail/python-chinese/attachments/20070409/70440a0c/attachment.html
2007年04月09日 星期一 11:14
random.shuffle On 4/8/07, miaozhaozhao20 <miaozhaozhao200在163.com> wrote: > 是的。这个函数可以。我刚想回复呢。呵呵 > > > > > 在2007-04-08,"东子" <hydonlee在gmail.com> 写道: > > > 貌似random.sample正好满足你的需要 > import random > > a = [2,5,8,0,1,7] > random.sample(a, len(a)) > > > 2007/4/8, linda. s <samrobertsmith在gmail.com >: > > Hi, > > 有一个 a list: [2,5,8,0,1,7], > > 如何用同样的元素随机产生新的list > > 如: > > [5,2,8,0,1,7] > > [8,0,7,1,5,2] > > 多谢!!! > > Linda > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to > python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to > python-chinese-request在lists.python.cn > > Detail Info: > http://python.cn/mailman/listinfo/python-chinese > > > > -- > 只要人间真情在, 何必在意路泥泞 > 时风日下,和谐需要靠暴力达到!!! > > ________________________________ > 远离垃圾邮件?免费帮你过滤98%的垃圾邮件! www.126.com > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to > python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to > python-chinese-request在lists.python.cn > Detail Info: > http://python.cn/mailman/listinfo/python-chinese >
2007年04月09日 星期一 13:04
Y , random.shuffle更快。 在07-4-9,shhgs <shhgs.efhilt at gmail.com> 写道: > > random.shuffle > > On 4/8/07, miaozhaozhao20 <miaozhaozhao200 at 163.com> wrote: > > 是的。这个函数可以。我刚想回复呢。呵呵 > > > > > > > > > > 在2007-04-08,"东子" <hydonlee at gmail.com> 写道: > > > > > > 貌似random.sample正好满足你的需要 > > import random > > > > a = [2,5,8,0,1,7] > > random.sample(a, len(a)) > > > > > > 2007/4/8, linda. s <samrobertsmith at gmail.com >: > > > Hi, > > > 有一个 a list: [2,5,8,0,1,7], > > > 如何用同样的元素随机产生新的list > > > 如: > > > [5,2,8,0,1,7] > > > [8,0,7,1,5,2] > > > 多谢!!! > > > Linda > > > _______________________________________________ > > > 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 > > > > > > > > -- > > 只要人间真情在, 何必在意路泥泞 > > 时风日下,和谐需要靠暴力达到!!! > > > > ________________________________ > > 远离垃圾邮件?免费帮你过滤98%的垃圾邮件! www.126.com > > _______________________________________________ > > 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 -- 只要人间真情在, 何必在意路泥泞 时风日下,和谐需要靠暴力达到!!! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://python.cn/pipermail/python-chinese/attachments/20070409/43dc1917/attachment.htm
Zeuux © 2025
京ICP备05028076号