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, ]
精彩评论