python 循环数字合并字符串

废话不多说,直接开干!

问题描述
如何将商品id,整合一条数据,一次查询

append() 方法用于在列表末尾添加新的对象。
join() 方法用于将序列中的元素以指定的字符连接生成一个新的字符串。
    shop = Model('cmf_tb_shop_succ')
    jd_goods = shop.select()
    jdgoods =[]
    for jds in jd_goods:
        jds_id = jds[1]
        jdgoods.append(jds_id)
    arr_good = ','.join(jdgoods)
    print(arr_good)

看下运行结果

169922536646,169915009958,162349760255,169874427432,162380040565,169944057671,169939309097,162374407229,169863567373,162376150719,169905446830,162414541239,162409704274,162405543441,169980803438,170029072938,162451188209,162470885599,170077105898,170076027777,162532439224,162524538713,162533589653,170140303173,162583417520,162581596573,170229830248,162701477360,162742019096,162732792435,170369183595,170305171118,162752925973,170389666147,162806854192,170355023823,162819325019,162830616501,162828887509,162856135728,162731734196,162839247065,162857918357,162836964795,170493353131,162866728735,170487039142,170429267247,162886993785,170437936077,170463434767,162912260978,162907624372,162935551389,170550018755,162938019666,170570846472,170599954630,162962637683,162950550324,170571760227,162943470800,170642132774,170572927949,170627058209,170566412111,170630640328,162987789489,163018382902,170590473548,163032174644,163042036053,170687636709,170677328843,170671890150,170664015819,170706494464,170646620814,163067678367,170641660557,163054437177,170694050848,170687594597,170699085478,163086565586,170658603020,170720068420,170714103810,170749594664,170739611202,163099413439,170676674509,170675773389,170694404012,163103795550,163107012346,163100246992,163083661435,163122634495,163125453012,170760750432,170768505990,170758257931,170731508877,170784950625,170783373698,170800827970,163148786045,170796563429,170795387886,170888075051,163007866104,170923408708,170885465229,163279205845,163277962836,170887627692,163297067514,170903123821,170963962407,170956307360,170893454510,163313352784,170965776578,163304798642,170991983239,170991146536,171005531045,163322921748,163313780153,171014526251,163334864601,171007176779,163342020496,163343130133,171008204741,163342245465,171030227435,161885359007,163371474961,163369675352,163382900530,171053770689,171047547010,171065251305,163382412215,171055469927,171050577706,171080549481,171083148676,163396731318,163403707736,171073631650,163394551952,163380116027,163410462201,171094693989,163410159614,171088851241,163406782774,171085536778,163412324049,163411951998,171087938888,171084336583,163435174717,171105958280,163419568415,163425254482,163428935581,171066923532,163443516950,171129042180,171118966849,163435140435,171121656900,171122522507,171124658312,171115029539,163431656881,163454150357,163459329620,163457757267,171141606889,163456469333,163471399504,163459445330,171140356163,171138341475,163457189746,163464466230,163514992095,171200984650,163504851892,163501480884,171178199875,163490981746,171186477345,171122188111,163501340090

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值