Traceback (most recent call last):
File "python", line 1, in
TypeError: bad operand type for unary +: 'str'

Oops, try again. Did you create a variable called my_file?

I expected this code to work perfectly, what is wrong?

my_file = open("output.txt", + "r")


my_file = open("output.txt", + "r")

There is no need to put + ?
general syntax we use..

open(file_name, mode_type)

More about it..
open function..


lol thank you very much it works fine


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.