import re
import os

def check_image_path(filename):
    with open(filename, "r") as f:
        content = f.read()

    # 使用正则表达式来匹配图片路径
    image_paths = re.findall(r"(.*?\.(jpg|jpeg|png|gif))", content)

    # 检查图片是否存在
    for image_path in image_paths:
        if not os.path.exists(image_path):
            print(f"图片 {image_path} 不存在")

if __name__ == "__main__":
    filename = "test.c"
    check_image_path(filename)
