如何在python中将数组字符串转换为数组 [英] How to convert array string to an array in python

查看:72
本文介绍了如何在python中将数组字符串转换为数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将存储在mysql数据库中的一个数组(作为字符串)转换为python中的标准数组,我的意思是:

Im trying to convert an array that ive stored in a mysql database (as a string) to a standard array in python an example of what I mean is:

这是我从数据库中得到的:

This is what i get from the database:

"['a',['b','c','d'],'e']" # this is a string in the format of an array that holds strings inside it.

我需要从字符串中删除数组,以使其像普通数组一样工作任何帮助将不胜感激.我不确定在其他地方是否已经回答了这个问题,如果无法找到它,我们感到抱歉.谢谢

I need to remove the array from the string so that it acts just like a normal array Any help would be greatly appreciated. I'm not sure if this has been answered elsewhere, sorry if it has I couldn't find it. Thanks

推荐答案

您可以使用

这篇关于如何在python中将数组字符串转换为数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆