You can download this code by clicking the button below.
This code is now available for download.
This function reads a CSV file at a specified path and returns a list of lists, where each inner list represents a row in the CSV file.
Technology Stack : csv, Builtin
Code Type : Python Function
Code Difficulty : Intermediate
import random
import csv
from robot.libraries.Builtin import BuiltIn
def read_csv_file(file_path, delimiter=','):
"""
This function reads a CSV file and returns a list of lists, where each inner list represents a row in the CSV file.
"""
rows = []
with open(file_path, mode='r', newline='', encoding='utf-8') as csvfile:
reader = csv.reader(csvfile, delimiter=delimiter)
for row in reader:
rows.append(row)
return rows