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