Life is short, you need Python

join --- connet string

join 方法用于连接字符串数组

= ['a''b''c''d']
print ''.join(s)
print '-'.join(s)


输出结果:
abcd
a-b-c-d

使用 % 连接多个变量

= 'hello'
= 'python'
= 1
print '%s %s %s %s' % (a, b, c, s)


输出结果:

hello python 1 ['a', 'b', 'c', 'd']

 

作者:CoderZhCoderZh的技术博客 - 博客园
出处:http://coderzh.cnblogs.com/

posted @ 2010-06-24 15:34  runfox545  阅读(399)  评论(0编辑  收藏  举报
白月黑羽 Python教程 白月黑羽Python