Preview:
def spark_read_file(file_path,file_format,schema=None):
    input_data = (
        spark.read.format(file_format)
        # .option("basePath", base_path)
        .option("header", "true")
        .schema(schema)
        .load(f"{file_path}*")
    )
    return input_data
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter