def sysarg_to_string(argv): """ Transform a list of strings into a single string Add quotes if needed :return: """ if argv is None or not argv: return "" result = "" first = True for s in argv: if not first: result += " " result += '"' + s + '"' if " " in s else s first = False return result