2004年04月23日 星期五 01:49
liux at gdcn.com,您好! ======== 2004-04-22 16:59:52 您在来信中写道: ======== ----- 原邮件 ----- 从: Who Bruce <whoonline at msn.com> 日期: 星期四, 四月 22日, 2004 下午12:40 主题: [python-chinese] 一个小题目 > 呵呵,今天怎么大家都没发邮件啦。出个小题目吧,有字符串 > s="%C6%E6%D5%E4%D2%EC%B1%A6" > 怎样由它得到列表 > l=["%C6","%E6","%D5","%E4","%D2","%EC","%B1","%A6"] > > 解法很多,要最简单的。 其实还可以进一步简化 I=["%" + x for x in s[1:].split("%")] 按索引切割的话,这个应该还是最简单的吧,用生成器恐怕会写多行 I=[s[x*3:x*3+3] for x in range(len(s)/3)] > > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > = = = = = = = = = = = = = = = = = = = = = = 致 礼! 刘鑫 liux at gdcn.com 2004-04-23 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20040423/b1d4acab/attachment.htm
Zeuux © 2024
京ICP备05028076号