Python论坛  - 讨论区

标题:[python-chinese] send()的参数问题

2005年05月01日 星期日 14:10

. newbie learnpython at gmail.com
Sun May 1 14:10:09 HKT 2005

我用a1,a2,a3 三个列表,然后用for循环对这3个列表的元素进行排列组合A=a1+a2+a3,这样就可以得到9个不同的字符串,然后我用send()发送这个A,
大体代码如下:
a1 = ["aaaaa", "bbbbb","ccccc"]
a2 = ["aaaaa", "bbbbb","ccccc"]
a3 = ["aaaaa", "bbbbb","ccccc"]
    for i in a1:
            for j in a2:
                 for k in a3:
                      A = a1 + a2 + a3
                      send(A)

结果执行时报错:TypeError: send() argument 1 must be string or read-only
buffer, not list

说类型不对,这个参数不能是list。 : (

请教大家,怎么办?

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

2005年05月01日 星期日 14:20

William Wu william at sinowish.com
Sun May 1 14:20:20 HKT 2005

A = "".join(a1 + a2 + a3)



. newbie wrote:

>ÎÒÓÃa1£¬a2£¬a3 Èý¸öÁÐ±í£¬È»ºóÓÃforÑ­»·¶ÔÕâ3¸öÁбíµÄÔªËؽøÐÐÅÅÁÐ×éºÏA=a1+a2+a3£¬ÕâÑù¾Í¿ÉÒԵõ½9¸ö²»Í¬µÄ×Ö·û´®£¬È»ºóÎÒÓÃsend()·¢ËÍÕâ¸öA£¬
>´óÌå´úÂëÈçÏ£º
>a1 = ["aaaaa", "bbbbb","ccccc"]
>a2 = ["aaaaa", "bbbbb","ccccc"]
>a3 = ["aaaaa", "bbbbb","ccccc"]
>    for i in a1:
>            for j in a2:
>                 for k in a3:
>                      A = a1 + a2 + a3
>                      send(A)
>
>½á¹ûÖ´ÐÐʱ±¨´í£ºTypeError: send() argument 1 must be string or read-only
>buffer, not list
>
>˵ÀàÐͲ»¶Ô£¬Õâ¸ö²ÎÊý²»ÄÜÊÇlist¡£ : (
>
>Çë½Ì´ó¼Ò£¬Ôõô°ì£¿
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>python-chinese list
>python-chinese at lists.python.cn
>http://python.cn/mailman/listinfo/python-chinese
>  
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: william.vcf
Type: text/x-vcard
Size: 146 bytes
Desc: not available
Url : http://lists.exoweb.net/pipermail/python-chinese/attachments/20050501/65bf15ef/william.vcf

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

2005年05月01日 星期日 14:21

Qiangning Hong hongqn at gmail.com
Sun May 1 14:21:27 HKT 2005

On 5/1/05, . newbie <learnpython at gmail.com> wrote:
> 
> 我用a1,a2,a3 
> 三个列表,然后用for循环对这3个列表的元素进行排列组合A=a1+a2+a3,这样就可以得到9个不同的字符串,然后我用send()发送这个A,
> 大体代码如下:
> a1 = ["aaaaa", "bbbbb","ccccc"]
> a2 = ["aaaaa", "bbbbb","ccccc"]
> a3 = ["aaaaa", "bbbbb","ccccc"]
> for i in a1:
> for j in a2:
> for k in a3:
> A = a1 + a2 + a3


把这句改成:A = i + j + k

send(A)
> 
> 结果执行时报错:TypeError: send() argument 1 must be string or read-only
> buffer, not list
> 
> 说类型不对,这个参数不能是list。 : (
> 
> 请教大家,怎么办?
> 
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
> 
> 
> 


-- 
Qiangning Hong
Get Firefox! <
http://www.spreadfirefox.com/?q=affiliates&id=67907&t=1>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050501/fa4bf9ee/attachment.htm

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

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

    你的回复:

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

    Zeuux © 2025

    京ICP备05028076号