benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf f007f0d1-792a-51bd-b3be-d39d1eedfdd7

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import xlwt
import os
import io
import csv

def task_func(csv_content, filename):
    """
    Converts CSV content into an Excel file and saves it with the given filename. The function reads the CSV content,
    creates a new Excel workbook, writes the data into the workbook, and saves it as an Excel file.

    Parameters:
    csv_content (str): The CSV content as a string, where rows are separated by newlines and columns by commas.
    filename (str): The name of the Excel file to be created, including the .xls extension.

    Returns:
    str: The absolute path of the created Excel file.

    Requirements:
    - xlwt
    - os
    - io
    - csv

    Examples:
    Convert simple CSV content to an Excel file and return its path.
    >>> csv_content = 'ID,Name,Age\\n1,John Doe,30\\n2,Jane Doe,28'
    >>> os.path.isfile(task_func(csv_content, 'test_data.xls'))
    True

    Create an Excel file with a single cell.
    >>> csv_content = 'Hello'
    >>> os.path.isfile(task_func(csv_content, 'single_cell.xls'))
    True
    """

instruct prompt

Converts CSV content into an Excel file and saves it with the given filename. The function reads the CSV content, creates a new Excel workbook, writes the data into the workbook, and saves it as an Excel file. Create an Excel file with a single cell. >>> csv_content = 'Hello' >>> os.path.isfile(task_func(csv_content, 'single_cell.xls')) True
The function should output with:
    str: The absolute path of the created Excel file.
You should write self-contained code starting with:

Code

import xlwt
import os
import io
import csv
def task_func(csv_content, filename):

code prompt

Code

import xlwt
import os
import io
import csv
def task_func(csv_content, filename):

entry point

task_func

libs

  • io
  • csv
  • xlwt
  • os

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import