This article describes the implementation of Python string array conversion function, analysis techniques and the associated implementation considerations Python string and an array of related conversion functions with specific examples of the form, need friends can refer to the following
article describes the Python implementation examples array string conversion function. Share to you for your reference, as follows:
Turn an array of strings
str = '1,2,3'
arr = str.split(',')
print a
The result:
Array to String
#方法1
arr = ['a','b']
str1 = ','.join(arr)
print str1
#方法2
arr = [1,2,3]
#str = ','.join(str(i) for i in arr)#此处str命名与str函数冲突!
str2 = ','.join(str(i) for i in arr)
print str2
The result:
recommend our learning Python buckle qun: 913066266, look at how seniors are learning! From basic web development python script to, reptiles, django, data mining, etc. [PDF, actual source code], zero-based projects to combat data are finishing. Given to every little python partner! Every day, Daniel explain the timing Python technology, to share some of the ways to learn and need to pay attention to small details, click on Join us python learner gathering