Python 练习范例 84
连接字符串
#!/usr/bin/python # -*- coding: UTF-8 -*- delimiter = ',' mylist = ['Brazil', 'Russia', 'India', 'China'] print delimiter.join(mylist)
以上 Python 代码输出结果如下
Brazil,Russia,India,China
连接字符串
#!/usr/bin/python # -*- coding: UTF-8 -*- delimiter = ',' mylist = ['Brazil', 'Russia', 'India', 'China'] print delimiter.join(mylist)
以上 Python 代码输出结果如下
Brazil,Russia,India,China
♥ 简单教程,简单编程 - IT 入门首选站
Copyright © 2013-2022 简单教程 twle.cn All Rights Reserved.