0 of 464 solved

Extract Columns from CSV

Write a function `read_csv_file(file_path, columns)` that reads a CSV file and returns only the requested columns for each row.

Return a list of dictionaries, where each dictionary contains the selected columns for one row.

#### Example
Input:
File Path: `"data.csv"`
Columns: `["Name", "Age", "City"]`
Output: `[{"Name": "John", "Age": "25", "City": "New York"}, {"Name": "Emma", "Age": "30", "City": "London"}]`
import csv

def read_csv_file(file_path, columns):
    """
    Reads a CSV file and extracts data from specific columns.

    Args:
    file_path (str): The path to the CSV file.
    columns (list): The list of column names to extract data from.

    Returns:
    list: A list of dictionaries containing the data from the specified columns.
    """
    # TODO: Implement the read_csv_file function
    pass