Your First Validation, The Easy Way
CsvPath is a very flexible language. There is often a simpler way than you first thought.
line(
string.notnone("firstname"),
string.notnone("lastname", 30),
string("say")
)from csvpath import CsvPath
csvpath = """
~
id: First Validation, Simplified!
description: Check if a file is valid
validation-mode: print, no-raise, fail
~
$trivial.csv[*][
line(
string.notnone("firstname"),
string.notnone("lastname", 30),
string("say")
)
]"""
path = CsvPath().parse(csvpath)
path.fast_forward()
if not path.is_valid:
print(f"The file is invalid")Last updated