import yaml


def validyaml(filename):
    """
    校验 YAML 格式是否正确

    :param filename: yaml文件路径
    :returns: True: 正确; False: 不正确
    """
    try:
        f = open(filename)
        str = f.read()
        yaml.safe_load(str)
        return True
    except Exception:
        return False