开发者

How can I convert a string to a list in python?

Let's say I have :

my_args = ["QA-65"]

as the desired result,

but in my function, I have:

            m = re.search("([a-zA-Z]+-\d+)",line)
            print 'printing m.group(1)'
            print m.group(1)
            m_args = m.group(1)
            print 'my_args '
            print m_args
            print type(m_args)

so that开发者_开发技巧 the type of "m_args" is string, i.e

How can I convert m_args to a list with just one element with the same content as the string?


Perhaps this:

my_args = [my_args]


You do it this way:

m_args = [m_args, ]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜