I need to convert spaces to %20 for api posts in a python array
tree = et.parse(os.environ['SPRINT_XML'])
olp = tree.findall(".//string")
if not olp:
print colored('FAILED', 'red') +" No jobs accociated to this view"
exit(1)
joblist = [t.text for t in olp]
How can I do that to t.text above?
Use the String.replace()
method as described here: http://www.tutorialspoint.com/python/string_replace.htm
So for t.text
, it would be t.text.replace(" ", "%20")