一、函数说明
join():连接字符串数组,将字符串,元组,列表中的元素以指定的字符(分隔符)连接生成一个新的字符串
二、实例
# 对列表进行操作sql = ['a','b','c','d']print(" ".join(sql))>>>a b c dprint(':'.join(sql))>>>a:b:c:d# 对字符串进行操作sql = "hello word"print(':'.join(sql))>>>h:l:l:o: :w:o:r:d# 对元组进行操作seq3 = ('hello','good')print(':'.join(seq3))>>>hello:good# 对字典进行操作seq4 = {'hello':1,'good':2}print(':'.join(seq4))>>>hello:good# 合并目录import osos.path.join('/hello/','good/boy')>>>hello/good/boy
