python 字串replace方法實現探索

吐司波妞發表於2024-07-18

python原始碼 https://github.com/python/cpython

str.replace() 是一個內建方法,用於替換字串中的某些子串。由於它是內建方法,因此你通常無法直接檢視其原始碼,因為它已經被編譯成位元組碼,並且是Python直譯器的一部分。
在GitHub倉庫中搜尋 Object/unicodeobject.c 檔案,然後搜尋 unicode_replace 函式。
https://github.com/python/cpython/blob/main/Objects/unicodeobject.c

相關文章