假设您可以将每个单独的页面放入文档的列表中
def remove_patient_data(documents: list, pattern: str) -> str:
document_buffer = ""
for count, document in enumerate(documents):
if count != 0:
document = document.replace(pattern, "")
document_buffer += document + '\n'
return document_buffer
my_documents = ["blah foo blah", "blah foo bar", "blah foo baz"]
remove_patient_data(my_documents, "foo")
会回来的
'blah foo blah\nblah bar\nblah baz\n'