我在Django视图中有一个数组,我想转换成逗号分隔的字符串,以便像将所有数据一样保存到DB字段中。
class FindInfo(object):
def __info__(request):
if request.method == 'POST':
name = request.POST.get('name')
address = request.POST.get('address')
phone = request.POST.get('phone')
info = {}
info['name'] = name
info['address'] = address
info['phone'] = phone
info = ["Younus", "DHA-A251", "+923228738738"]
我什么都没得到呢? 我需要这样的输出。
sting = "Ford,Volvo,BMW"
答案 0 :(得分:-1)
','.join(your_array)
请将该解决方案标记为有效,以避免所有其他人都在评论中发掘...