{"id":1186937,"date":"2025-01-15T19:59:00","date_gmt":"2025-01-15T11:59:00","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1186937.html"},"modified":"2025-01-15T19:59:03","modified_gmt":"2025-01-15T11:59:03","slug":"python%e5%a4%9a%e4%b8%aa%e6%96%87%e4%bb%b6%e5%a6%82%e4%bd%95%e6%af%94%e8%be%83%e5%86%85%e5%ae%b9","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1186937.html","title":{"rendered":"python\u591a\u4e2a\u6587\u4ef6\u5982\u4f55\u6bd4\u8f83\u5185\u5bb9"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25135619\/c2e0b748-e321-44b4-8135-9388361d689d.webp\" alt=\"python\u591a\u4e2a\u6587\u4ef6\u5982\u4f55\u6bd4\u8f83\u5185\u5bb9\" \/><\/p>\n<p><p> \u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\u6765\u6bd4\u8f83\u591a\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u3002<strong>\u6587\u4ef6\u6bd4\u8f83\u7684\u5e38\u7528\u65b9\u6cd5\u5305\u62ec\u9010\u884c\u8bfb\u53d6\u3001\u4f7f\u7528\u6587\u4ef6\u54c8\u5e0c\u503c\u3001\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u5982filecmp\u548cdifflib<\/strong>\u3002\u8fd9\u91cc\u6211\u4eec\u5c06\u8be6\u7ec6\u63a2\u8ba8\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u5e76\u5c55\u793a\u5982\u4f55\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u5e94\u7528\u5b83\u4eec\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u9010\u884c\u8bfb\u53d6\u6bd4\u8f83<\/h3>\n<\/p>\n<p><p>\u9010\u884c\u8bfb\u53d6\u5e76\u6bd4\u8f83\u662f\u6700\u76f4\u63a5\u7684\u6587\u4ef6\u6bd4\u8f83\u65b9\u6cd5\u3002\u5b83\u9002\u7528\u4e8e\u6587\u4ef6\u8f83\u5c0f\u6216\u9700\u8981\u9010\u884c\u6bd4\u8f83\u5185\u5bb9\u7684\u60c5\u51b5\u3002<\/p>\n<\/p>\n<p><h4>1.1 \u57fa\u672c\u9010\u884c\u6bd4\u8f83<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">def compare_files_line_by_line(file1, file2):<\/p>\n<p>    with open(file1, &#39;r&#39;) as f1, open(file2, &#39;r&#39;) as f2:<\/p>\n<p>        for line1, line2 in zip(f1, f2):<\/p>\n<p>            if line1 != line2:<\/p>\n<p>                return False<\/p>\n<p>    return True<\/p>\n<h2><strong>\u793a\u4f8b\u4f7f\u7528<\/strong><\/h2>\n<p>file1 = &#39;file1.txt&#39;<\/p>\n<p>file2 = &#39;file2.txt&#39;<\/p>\n<p>result = compare_files_line_by_line(file1, file2)<\/p>\n<p>print(f&quot;\u6587\u4ef6\u76f8\u540c: {result}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u7b80\u5355\u76f4\u89c2\uff0c\u4f46\u5bf9\u4e8e\u5927\u6587\u4ef6\u6548\u7387\u53ef\u80fd\u4e0d\u9ad8\u3002<\/p>\n<\/p>\n<p><h4>1.2 \u4f7f\u7528\u751f\u6210\u5668\u9010\u884c\u6bd4\u8f83<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528\u751f\u6210\u5668\u53ef\u4ee5\u63d0\u9ad8\u5185\u5b58\u6548\u7387\uff0c\u7279\u522b\u9002\u5408\u5904\u7406\u5927\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def file_line_generator(filepath):<\/p>\n<p>    with open(filepath, &#39;r&#39;) as file:<\/p>\n<p>        for line in file:<\/p>\n<p>            yield line<\/p>\n<p>def compare_files_with_generators(file1, file2):<\/p>\n<p>    gen1 = file_line_generator(file1)<\/p>\n<p>    gen2 = file_line_generator(file2)<\/p>\n<p>    for line1, line2 in zip(gen1, gen2):<\/p>\n<p>        if line1 != line2:<\/p>\n<p>            return False<\/p>\n<p>    return True<\/p>\n<h2><strong>\u793a\u4f8b\u4f7f\u7528<\/strong><\/h2>\n<p>result = compare_files_with_generators(file1, file2)<\/p>\n<p>print(f&quot;\u6587\u4ef6\u76f8\u540c: {result}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u6587\u4ef6\u54c8\u5e0c\u6bd4\u8f83<\/h3>\n<\/p>\n<p><p>\u6587\u4ef6\u54c8\u5e0c\u503c\u6bd4\u8f83\u662f\u4e00\u79cd\u9ad8\u6548\u7684\u65b9\u6cd5\uff0c\u9002\u7528\u4e8e\u9700\u8981\u5feb\u901f\u5224\u65ad\u6587\u4ef6\u5185\u5bb9\u662f\u5426\u76f8\u540c\u7684\u60c5\u51b5\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Python\u7684<code>hashlib<\/code>\u5e93\u6765\u8ba1\u7b97\u6587\u4ef6\u7684\u54c8\u5e0c\u503c\u3002<\/p>\n<\/p>\n<p><h4>2.1 \u8ba1\u7b97\u6587\u4ef6\u7684MD5\u54c8\u5e0c\u503c<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import hashlib<\/p>\n<p>def calculate_md5(filepath):<\/p>\n<p>    hash_md5 = hashlib.md5()<\/p>\n<p>    with open(filepath, &#39;rb&#39;) as file:<\/p>\n<p>        for chunk in iter(lambda: file.read(4096), b&quot;&quot;):<\/p>\n<p>            hash_md5.update(chunk)<\/p>\n<p>    return hash_md5.hexdigest()<\/p>\n<p>def compare_files_with_md5(file1, file2):<\/p>\n<p>    return calculate_md5(file1) == calculate_md5(file2)<\/p>\n<h2><strong>\u793a\u4f8b\u4f7f\u7528<\/strong><\/h2>\n<p>result = compare_files_with_md5(file1, file2)<\/p>\n<p>print(f&quot;\u6587\u4ef6\u76f8\u540c: {result}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2.2 \u5176\u4ed6\u54c8\u5e0c\u7b97\u6cd5<\/h4>\n<\/p>\n<p><p>\u9664\u4e86MD5\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528SHA-1\u3001SHA-256\u7b49\u54c8\u5e0c\u7b97\u6cd5\u6765\u6bd4\u8f83\u6587\u4ef6\u5185\u5bb9\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def calculate_sha256(filepath):<\/p>\n<p>    hash_sha256 = hashlib.sha256()<\/p>\n<p>    with open(filepath, &#39;rb&#39;) as file:<\/p>\n<p>        for chunk in iter(lambda: file.read(4096), b&quot;&quot;):<\/p>\n<p>            hash_sha256.update(chunk)<\/p>\n<p>    return hash_sha256.hexdigest()<\/p>\n<p>def compare_files_with_sha256(file1, file2):<\/p>\n<p>    return calculate_sha256(file1) == calculate_sha256(file2)<\/p>\n<h2><strong>\u793a\u4f8b\u4f7f\u7528<\/strong><\/h2>\n<p>result = compare_files_with_sha256(file1, file2)<\/p>\n<p>print(f&quot;\u6587\u4ef6\u76f8\u540c: {result}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528filecmp\u5e93<\/h3>\n<\/p>\n<p><p><code>filecmp<\/code>\u662fPython\u6807\u51c6\u5e93\u4e2d\u7684\u6a21\u5757\uff0c\u4e13\u95e8\u7528\u4e8e\u6587\u4ef6\u548c\u76ee\u5f55\u7684\u6bd4\u8f83\u3002\u5b83\u63d0\u4f9b\u4e86\u7b80\u5355\u800c\u5f3a\u5927\u7684\u63a5\u53e3\u6765\u6bd4\u8f83\u6587\u4ef6\u5185\u5bb9\u3002<\/p>\n<\/p>\n<p><h4>3.1 \u6bd4\u8f83\u5355\u4e2a\u6587\u4ef6<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import filecmp<\/p>\n<p>def compare_files_with_filecmp(file1, file2):<\/p>\n<p>    return filecmp.cmp(file1, file2, shallow=False)<\/p>\n<h2><strong>\u793a\u4f8b\u4f7f\u7528<\/strong><\/h2>\n<p>result = compare_files_with_filecmp(file1, file2)<\/p>\n<p>print(f&quot;\u6587\u4ef6\u76f8\u540c: {result}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3.2 \u6bd4\u8f83\u76ee\u5f55<\/h4>\n<\/p>\n<p><p><code>filecmp<\/code>\u4e5f\u53ef\u4ee5\u7528\u4e8e\u6bd4\u8f83\u4e24\u4e2a\u76ee\u5f55\uff0c\u67e5\u770b\u5b83\u4eec\u662f\u5426\u5305\u542b\u76f8\u540c\u7684\u6587\u4ef6\u548c\u5b50\u76ee\u5f55\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def compare_directories(dir1, dir2):<\/p>\n<p>    comparison = filecmp.dircmp(dir1, dir2)<\/p>\n<p>    comparison.report()<\/p>\n<p>    return comparison.left_only, comparison.right_only, comparison.diff_files<\/p>\n<h2><strong>\u793a\u4f8b\u4f7f\u7528<\/strong><\/h2>\n<p>dir1 = &#39;dir1&#39;<\/p>\n<p>dir2 = &#39;dir2&#39;<\/p>\n<p>left_only, right_only, diff_files = compare_directories(dir1, dir2)<\/p>\n<p>print(f&quot;\u53ea\u5728 {dir1} \u4e2d\u5b58\u5728\u7684\u6587\u4ef6: {left_only}&quot;)<\/p>\n<p>print(f&quot;\u53ea\u5728 {dir2} \u4e2d\u5b58\u5728\u7684\u6587\u4ef6: {right_only}&quot;)<\/p>\n<p>print(f&quot;\u4e0d\u540c\u7684\u6587\u4ef6: {diff_files}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528difflib\u5e93<\/h3>\n<\/p>\n<p><p><code>difflib<\/code>\u662f\u53e6\u4e00\u4e2aPython\u6807\u51c6\u5e93\u6a21\u5757\uff0c\u63d0\u4f9b\u4e86\u4e00\u4e9b\u7528\u4e8e\u6bd4\u8f83\u5e8f\u5217\u7684\u5de5\u5177\u3002\u5b83\u7279\u522b\u9002\u5408\u7528\u4e8e\u6587\u672c\u6587\u4ef6\u7684\u6bd4\u8f83\u548c\u751f\u6210\u5dee\u5f02\u62a5\u544a\u3002<\/p>\n<\/p>\n<p><h4>4.1 \u6bd4\u8f83\u6587\u4ef6\u5185\u5bb9<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import difflib<\/p>\n<p>def compare_files_with_difflib(file1, file2):<\/p>\n<p>    with open(file1, &#39;r&#39;) as f1, open(file2, &#39;r&#39;) as f2:<\/p>\n<p>        f1_lines = f1.readlines()<\/p>\n<p>        f2_lines = f2.readlines()<\/p>\n<p>    diff = difflib.unified_diff(f1_lines, f2_lines, fromfile=file1, tofile=file2)<\/p>\n<p>    return list(diff)<\/p>\n<h2><strong>\u793a\u4f8b\u4f7f\u7528<\/strong><\/h2>\n<p>diff = compare_files_with_difflib(file1, file2)<\/p>\n<p>if diff:<\/p>\n<p>    print(&quot;\u6587\u4ef6\u4e0d\u540c:&quot;)<\/p>\n<p>    for line in diff:<\/p>\n<p>        print(line, end=&#39;&#39;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;\u6587\u4ef6\u76f8\u540c&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4.2 \u751f\u6210HTML\u5dee\u5f02\u62a5\u544a<\/h4>\n<\/p>\n<p><p><code>difflib<\/code>\u8fd8\u53ef\u4ee5\u751f\u6210HTML\u683c\u5f0f\u7684\u5dee\u5f02\u62a5\u544a\uff0c\u65b9\u4fbf\u67e5\u770b\u548c\u5171\u4eab\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def generate_diff_report(file1, file2, output_file):<\/p>\n<p>    with open(file1, &#39;r&#39;) as f1, open(file2, &#39;r&#39;) as f2:<\/p>\n<p>        f1_lines = f1.readlines()<\/p>\n<p>        f2_lines = f2.readlines()<\/p>\n<p>    diff = difflib.HtmlDiff().make_file(f1_lines, f2_lines, fromdesc=file1, todesc=file2)<\/p>\n<p>    with open(output_file, &#39;w&#39;) as output:<\/p>\n<p>        output.write(diff)<\/p>\n<h2><strong>\u793a\u4f8b\u4f7f\u7528<\/strong><\/h2>\n<p>output_file = &#39;diff_report.html&#39;<\/p>\n<p>generate_diff_report(file1, file2, output_file)<\/p>\n<p>print(f&quot;\u5dee\u5f02\u62a5\u544a\u5df2\u751f\u6210: {output_file}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u7efc\u5408\u5e94\u7528\u6848\u4f8b<\/h3>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u53ef\u80fd\u9700\u8981\u7efc\u5408\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\u6765\u6bd4\u8f83\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u5148\u4f7f\u7528\u54c8\u5e0c\u503c\u6bd4\u8f83\uff0c\u5982\u679c\u53d1\u73b0\u54c8\u5e0c\u503c\u4e0d\u540c\uff0c\u518d\u4f7f\u7528\u9010\u884c\u6bd4\u8f83\u6765\u627e\u51fa\u5177\u4f53\u5dee\u5f02\u3002<\/p>\n<\/p>\n<p><h4>5.1 \u7efc\u5408\u6bd4\u8f83\u51fd\u6570<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">def comprehensive_compare(file1, file2):<\/p>\n<p>    if not compare_files_with_md5(file1, file2):<\/p>\n<p>        print(&quot;\u6587\u4ef6\u54c8\u5e0c\u503c\u4e0d\u540c\uff0c\u5f00\u59cb\u9010\u884c\u6bd4\u8f83...&quot;)<\/p>\n<p>        diff = compare_files_with_difflib(file1, file2)<\/p>\n<p>        if diff:<\/p>\n<p>            print(&quot;\u6587\u4ef6\u4e0d\u540c:&quot;)<\/p>\n<p>            for line in diff:<\/p>\n<p>                print(line, end=&#39;&#39;)<\/p>\n<p>        else:<\/p>\n<p>            print(&quot;\u6587\u4ef6\u5185\u5bb9\u76f8\u540c\uff0c\u4f46\u54c8\u5e0c\u503c\u4e0d\u540c&quot;)<\/p>\n<p>    else:<\/p>\n<p>        print(&quot;\u6587\u4ef6\u76f8\u540c&quot;)<\/p>\n<h2><strong>\u793a\u4f8b\u4f7f\u7528<\/strong><\/h2>\n<p>comprehensive_compare(file1, file2)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>5.2 \u6bd4\u8f83\u591a\u4e2a\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u9700\u8981\u6bd4\u8f83\u591a\u4e2a\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u5faa\u73af\u6216\u5e76\u884c\u5904\u7406\u6765\u63d0\u9ad8\u6548\u7387\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import os<\/p>\n<p>from concurrent.futures import ThreadPoolExecutor<\/p>\n<p>def compare_multiple_files(file_list1, file_list2):<\/p>\n<p>    with ThreadPoolExecutor() as executor:<\/p>\n<p>        results = list(executor.map(comprehensive_compare, file_list1, file_list2))<\/p>\n<p>    return results<\/p>\n<h2><strong>\u793a\u4f8b\u4f7f\u7528<\/strong><\/h2>\n<p>file_list1 = [&#39;file1.txt&#39;, &#39;file2.txt&#39;]<\/p>\n<p>file_list2 = [&#39;file1_copy.txt&#39;, &#39;file2_copy.txt&#39;]<\/p>\n<p>compare_multiple_files(file_list1, file_list2)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86Python\u4e2d\u6bd4\u8f83\u591a\u4e2a\u6587\u4ef6\u5185\u5bb9\u7684\u51e0\u79cd\u65b9\u6cd5\uff0c<strong>\u5305\u62ec\u9010\u884c\u8bfb\u53d6\u3001\u4f7f\u7528\u6587\u4ef6\u54c8\u5e0c\u503c\u3001\u4f7f\u7528filecmp\u5e93\u548cdifflib\u5e93<\/strong>\u3002\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u9002\u7528\u573a\u666f\u548c\u4f18\u7f3a\u70b9\u3002\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\uff0c\u6216\u8005\u7efc\u5408\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\u6765\u63d0\u9ad8\u6bd4\u8f83\u6548\u7387\u548c\u51c6\u786e\u6027\u3002\u5e0c\u671b\u8fd9\u4e9b\u5185\u5bb9\u80fd\u5e2e\u52a9\u60a8\u66f4\u597d\u5730\u7406\u89e3\u548c\u5e94\u7528\u6587\u4ef6\u6bd4\u8f83\u6280\u672f\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u6bd4\u8f83\u591a\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u4ee5\u627e\u51fa\u5dee\u5f02\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528<code>difflib<\/code>\u6a21\u5757\u6765\u6bd4\u8f83\u591a\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u3002\u9996\u5148\uff0c\u60a8\u9700\u8981\u8bfb\u53d6\u6240\u6709\u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u7136\u540e\u4f7f\u7528<code>difflib.unified_diff<\/code>\u6216<code>difflib.ndiff<\/code>\u7b49\u65b9\u6cd5\u6765\u6bd4\u8f83\u5b83\u4eec\u3002\u8fd9\u6837\u53ef\u4ee5\u6e05\u695a\u5730\u770b\u5230\u6587\u4ef6\u4e4b\u95f4\u7684\u4e0d\u540c\u4e4b\u5904\uff0c\u5e2e\u52a9\u60a8\u5feb\u901f\u5b9a\u4f4d\u66f4\u6539\u6216\u9519\u8bef\u3002<\/p>\n<p><strong>\u662f\u5426\u6709\u5e93\u53ef\u4ee5\u5e2e\u52a9\u6211\u66f4\u65b9\u4fbf\u5730\u6bd4\u8f83\u6587\u4ef6\u5185\u5bb9\uff1f<\/strong><br \/>\u662f\u7684\uff0c\u9664\u4e86<code>difflib<\/code>\u4e4b\u5916\uff0c\u8fd8\u6709\u5176\u4ed6\u4e00\u4e9b\u6d41\u884c\u7684\u5e93\uff0c\u4f8b\u5982<code>pandas<\/code>\u548c<code>filecmp<\/code>\u3002<code>pandas<\/code>\u9002\u5408\u4e8e\u5904\u7406\u8868\u683c\u6570\u636e\u7684\u6587\u4ef6\u6bd4\u8f83\uff0c\u800c<code>filecmp<\/code>\u5219\u9002\u7528\u4e8e\u6bd4\u8f83\u6587\u4ef6\u548c\u76ee\u5f55\u3002\u6839\u636e\u60a8\u7684\u5177\u4f53\u9700\u6c42\uff0c\u9009\u62e9\u6700\u9002\u5408\u7684\u5de5\u5177\u5c06\u4f7f\u6bd4\u8f83\u8fc7\u7a0b\u66f4\u52a0\u7b80\u4fbf\u3002<\/p>\n<p><strong>\u5728\u6bd4\u8f83\u6587\u4ef6\u5185\u5bb9\u65f6\uff0c\u5982\u4f55\u5904\u7406\u5927\u6587\u4ef6\u4ee5\u63d0\u9ad8\u6548\u7387\uff1f<\/strong><br \/>\u5904\u7406\u5927\u6587\u4ef6\u65f6\uff0c\u9010\u884c\u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9\u800c\u4e0d\u662f\u4e00\u6b21\u6027\u52a0\u8f7d\u6574\u4e2a\u6587\u4ef6\u5230\u5185\u5b58\u4e2d\u662f\u4e00\u4e2a\u597d\u65b9\u6cd5\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528Python\u7684\u6587\u4ef6\u8fed\u4ee3\u5668\u9010\u884c\u8bfb\u53d6\u6587\u4ef6\uff0c\u7ed3\u5408<code>difflib<\/code>\u8fdb\u884c\u6bd4\u8f83\u3002\u8fd9\u6837\u53ef\u4ee5\u6709\u6548\u964d\u4f4e\u5185\u5b58\u4f7f\u7528\uff0c\u5e76\u63d0\u9ad8\u5904\u7406\u901f\u5ea6\uff0c\u5c24\u5176\u662f\u5728\u6587\u4ef6\u975e\u5e38\u5927\u7684\u60c5\u51b5\u4e0b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\u6765\u6bd4\u8f83\u591a\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u3002\u6587\u4ef6\u6bd4\u8f83\u7684\u5e38\u7528\u65b9\u6cd5\u5305\u62ec\u9010\u884c\u8bfb\u53d6\u3001\u4f7f\u7528\u6587\u4ef6\u54c8\u5e0c\u503c\u3001\u4f7f\u7528\u7b2c [&hellip;]","protected":false},"author":3,"featured_media":1186942,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1186937"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1186937"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1186937\/revisions"}],"predecessor-version":[{"id":1186943,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1186937\/revisions\/1186943"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1186942"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1186937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1186937"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1186937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}