benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 08f40a16-770d-5d36-a26d-3858f8b3dce5

Problem

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

complete prompt

import urllib.request
from bs4 import BeautifulSoup
import csv
import os

# Constants
CSV_FILE_PATH = 'scraped_data.csv'

def task_func(url):
    """
    Scrape data from a given URL and save the scraped data to a CSV file.

    Parameters:
    - url (str): The URL to scrape data from.

    Returns:
    - CSV_FILE_PATH (str): The path of the CSV file where the scraped data is saved.

    Requirements:
    - urllib
    - bs4
    - csv
    - os

    Example:
    >>> task_func('http://www.example.com/')
    'scraped_data.csv'
    """

instruct prompt

Scrape data from a given URL and save the scraped data to a CSV file.
The function should output with:
    CSV_FILE_PATH (str): The path of the CSV file where the scraped data is saved.
You should write self-contained code starting with:

Code

import urllib.request
from bs4 import BeautifulSoup
import csv
import os
# Constants
CSV_FILE_PATH = 'scraped_data.csv'
def task_func(url):

code prompt

Code

import urllib.request
from bs4 import BeautifulSoup
import csv
import os
# Constants
CSV_FILE_PATH = 'scraped_data.csv'
def task_func(url):

entry point

task_func

libs

  • csv
  • urllib
  • bs4
  • 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