擅长:python、mysql、java
<p>根据<a href="https://docs.python.org/3/library/re.html#re.sub" rel="nofollow noreferrer">^{<cd1>}</a>的文档,下面是如何做到这一点的:</p>
<pre><code>with open("test.json") as file:
json_data = file.read()
new_json = re.sub("NumberInt\(([0-9]+)\)", r"\1", json_data)
</code></pre>
<p>请注意,<code>re.sub()</code>返回字符串的副本,就像内置的<a href="https://docs.python.org/3/library/stdtypes.html#str.replace" rel="nofollow noreferrer">^{<cd3>}</a>方法一样。你知道吗</p>