Ask Question
1 September, 21:02

Define a Python function named file_listers with two parameters. The first parameter will be a string specifying the name of the file to write to. The second parameter will be a list of str. Your function should open the file in a manner that erases its contents. For each entry in the second parameter, write it to the file and then a newline. Your function does not need to return anything. Example:list_2_file ("empty. txt", []) creates a file named empty. txt but that file will be empty. list_2_file ("simple. txt", ["Write", "me"]) creates a file named simple. txt which contains two lines of text. The first line has the text Write and the second line says me.

+1
Answers (1)
  1. 2 September, 00:01
    0
    Check the explanation

    Explanation:

    we can now create a file named simple. txt which contains two lines of text

    below is the solution to the question:

    def file_listers (filename, strlist):

    name=raw_input (filename)

    file = open (file, 'w')

    with file as ≠:

    for i in range (0, len (strlist)):

    f. write (strlist[i]+"/n")

    file. close ();
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Define a Python function named file_listers with two parameters. The first parameter will be a string specifying the name of the file to ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers