Create Python file default identification error

Asked 2 years ago, Updated 2 years ago, 16 views


for i in range(1, 51):
     with open(str(i) + "park.txt", "w", encoding=:"utf8") as report_files:
        report_files.write("-{0} Weekly Report-".format(i))
        report_files.write("\nJob: ")
        report_files.write("\nName: ")
        report_files.write("\nDo: ")

Weekly Report File Creation Program for Week 50.

I'm sure there's no problem with grammar fori in range(1,51): indicates the detection error

Is there a problem with the code? Is it a program setting problem?

python

2022-09-20 19:08

1 Answers

There is a typo on the second line. Replace encoding=:"utf8" with encoding="utf8" and run.


2022-09-20 19:08

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.