练习三十三:用Python join()逗号分隔列表

用Python join()分隔列表

1 list1 = ["one","two","three","four"]
2 print(",".join(list1))
3 print("?".join(list1))
4 print("!".join(list1))
5 print("#".join(list1))
6 print("abc".join(list1))
7 print("123".join(list1))

执行结果:

one,two,three,four
one?two?three?four
one!two!three!four
one#two#three#four
oneabctwoabcthreeabcfour
one123two123three123four

 

posted @ 2018-12-01 14:20  阳光宝贝-沐沐  阅读(1567)  评论(0编辑  收藏  举报