import re path = '/opt/ai-os/products/ceo/projects/blog/vwg-content/tai-sao-chon-viet-nam/draft_vi_v1.md' with open(path, 'r', encoding='utf-8') as f: text = f.read() # update word count text = text.replace("Tổng số từ: 5428 từ", "Tổng số từ: 5226 từ") text = text.replace("* Đếm từ bài viết: 5428 từ", "* Đếm từ bài viết: 5226 từ") with open(path, 'w', encoding='utf-8') as f: f.write(text) print("Updated header word counts")