擅长:python、mysql、java
<p>以下是解决您问题的可能方法:</p>
<pre><code>import argparse
parser = argparse.ArgumentParser(description='Test.')
parser.add_argument('text', action='store', type=str, help='The text to parse.')
args = parser.parse_args()
print '-' * 80
raw_text = eval('"' + args.text.replace('"', '\\"') + '"')
print raw_text
print '-' * 80
print args.text
</code></pre>
<p>但要注意一件事,<a href="http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html" rel="nofollow">eval really is dangerous</a></p>