211k views
3 votes
Write a statement that opens a file named 'client_list.txt' for appending and assigns the resulting file object to a variable named f.

1 Answer

3 votes

Answer:

f = open('client_list.txt', 'a+')

Step-by-step explanation:

The question is answered in python.

The syntax to open a file is:

file-object-variable-name = open('file-name','file-mode')

In this question:

The file-object-variable-name is f

The file-name is client_list.txt

The file mode is a+ which means to append.

Hence, the statement that does the instruction in the question is:

f = open('client_list.txt', 'a+') or f = open("client_list.txt", "a+")

User Chenge
by
6.4k points