2005年12月06日 星期二 08:28
据我的观察,Python的List的赋值实际是赋的指针。所以,需要将整个List赋值的话,我现在就是用for i in range (len(x)):y.append(x[i]) 的办法。请问有没有更好的办法。 Chaos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20051206/27bfce4b/attachment.html
2005年12月06日 星期二 09:05
在05-12-6,超卓 <chaoszhuo at gmail.com> 写道: > > 据我的观察,Python的List的赋值实际是赋的指针。所以,需要将整个List赋值的话,我现在就是用for i in range > (len(x)):y.append(x[i]) 的办法。请问有没有更好的办法。 > y = x[:] Chaos > > _______________________________________________ > 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/20051206/870d0a58/attachment.htm
2005年12月06日 星期二 14:50
hehe, 真的行呀! 这是个众所周知的秘密吧。哪里有说呀?我怎么没发现? Chaos 在05-12-6,Jason Liu <telecomliu at gmail.com> 写道: > > > > 在05-12-6,超卓 <chaoszhuo at gmail.com> 写道: > > > > 据我的观察,Python的List的赋值实际是赋的指针。所以,需要将整个List赋值的话,我现在就是用for i in range > > (len(x)):y.append(x[i]) 的办法。请问有没有更好的办法。 > > > > y = x[:] > > Chaos > > > > _______________________________________________ > > 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://lists.exoweb.net/pipermail/python-chinese/attachments/20051206/ab188136/attachment.htm
Zeuux © 2025
京ICP备05028076号