方法集锦3_字符串_python

1.字符串拼接,join和列表的配合使用

a = ''
d = ['d','h','t','dg','gh']
a = a.join(i for i in d)
print(a)

运行结果:

PS D:\Python\Code_Python\lintcode> & D:/python_install/python.exe d:/Python/Code_Python/lintcode/lintcode_test12.py
dhtdggh

 

posted @ 2020-05-06 01:32  风不再来  阅读(113)  评论(0编辑  收藏  举报