2006年06月27日 星期二 08:20
以下程序为什么错? >>> p '\n3 1 5 5\n2 6 5 1\n10 1 44 10\n66 55 15 1 \n88 2 20 99\n' >>> s=[ map(int,seg.split()) for seg in p.strip().split("\n")] Traceback (most recent call last): File "", line 1, in ? TypeError: 'tuple' object is not callable Linda
2006年06月27日 星期二 08:56
是不是你前面有一个tuple被命名为map? linda.s 写道: > 以下程序为什么错? >>>> p > '\n3 1 5 5\n2 6 5 1\n10 1 44 10\n66 55 15 1 \n88 2 20 99\n' >>>> s=[ map(int,seg.split()) for seg in p.strip().split("\n")] > Traceback (most recent call last): > File "", line 1, in ? > TypeError: 'tuple' object is not callable > > 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
2006年06月27日 星期二 09:06
好象没有啊,我试了一下: >>> mapOn 6/26/06, Ni ZhengGang <ni at twinisa.com> wrote: > 是不是你前面有一个tuple被命名为map? > > linda.s 写道: > > 以下程序为什么错? > >>>> p > > '\n3 1 5 5\n2 6 5 1\n10 1 44 10\n66 55 15 1 \n88 2 20 99\n' > >>>> s=[ map(int,seg.split()) for seg in p.strip().split("\n")] > > Traceback (most recent call last): > > File " ", line 1, in ? > > TypeError: 'tuple' object is not callable > > > > 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 > > _______________________________________________ > 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 >
2006年06月27日 星期二 09:11
On 6/27/06, linda. s <samrobertsmith at gmail.com> wrote: > 好象没有啊,我试了一下: > >>> map >> 你换到python的dos命令行上再试试。就执行两句话: p = '\n3 1 5 5\n2 6 5 1\n10 1 44 10\n66 55 15 1 \n88 2 20 99\n' s=[ map(int,seg.split()) for seg in p.strip().split("\n")] -- I like python! My Blog: http://www.donews.net/limodou My Django Site: http://www.djangocn.org NewEdit Maillist: http://groups.google.com/group/NewEdit
2006年06月27日 星期二 09:22
On 6/26/06, limodou <limodou at gmail.com> wrote: > On 6/27/06, linda. s <samrobertsmith at gmail.com> wrote: > > 好象没有啊,我试了一下: > > >>> map > >> > > 你换到python的dos命令行上再试试。就执行两句话: > > p = '\n3 1 5 5\n2 6 5 1\n10 1 44 10\n66 55 15 1 \n88 2 20 99\n' > s=[ map(int,seg.split()) for seg in p.strip().split("\n")] > 是正常的. 奇怪的是为什么在运行了一个相关的程序后(这两句在test.py里面), python -i test.py 我重新给数值,为什么错呢?-i究竟有多大影响啊? >>> p = '\n3 1 5 5\n2 6 5 1\n10 1 44 10\n66 55 15 1 \n88 2 20 99\n' >>> p '\n3 1 5 5\n2 6 5 1\n10 1 44 10\n66 55 15 1 \n88 2 20 99\n' >>> s=[ map(int,seg.split()) for seg in p.strip().split("\n")] Traceback (most recent call last): File " ", line 1, in ? TypeError: 'tuple' object is not callable
2006年06月27日 星期二 09:27
On 6/27/06, linda. s <samrobertsmith at gmail.com> wrote: > On 6/26/06, limodou <limodou at gmail.com> wrote: > > On 6/27/06, linda. s <samrobertsmith at gmail.com> wrote: > > > 好象没有啊,我试了一下: > > > >>> map > > >> > > > > 你换到python的dos命令行上再试试。就执行两句话: > > > > p = '\n3 1 5 5\n2 6 5 1\n10 1 44 10\n66 55 15 1 \n88 2 20 99\n' > > s=[ map(int,seg.split()) for seg in p.strip().split("\n")] > > > 是正常的. > 奇怪的是为什么在运行了一个相关的程序后(这两句在test.py里面), > python -i test.py > 我重新给数值,为什么错呢?-i究竟有多大影响啊? > >>> p = '\n3 1 5 5\n2 6 5 1\n10 1 44 10\n66 55 15 1 \n88 2 20 99\n' > >>> p > '\n3 1 5 5\n2 6 5 1\n10 1 44 10\n66 55 15 1 \n88 2 20 99\n' > >>> s=[ map(int,seg.split()) for seg in p.strip().split("\n")] > Traceback (most recent call last): > File " ", line 1, in ? > TypeError: 'tuple' object is not callable > 我想是你的程序中有问题。你可以把程序就留下两行,执行。我想应该是没有问题的。一定是前面某个地方有问题。 -- I like python! My Blog: http://www.donews.net/limodou My Django Site: http://www.djangocn.org NewEdit Maillist: http://groups.google.com/group/NewEdit
Zeuux © 2025
京ICP备05028076号