Python oserror: [errno 22] invalid argument: solution

ERROR: [Errno 22] Invalid argument:

Method 1: Incorrect input format

 f = open('F:\Python 3.6\test.txt','r')

It should be modified to:

f = open('f:\\Python 3.6\\test.txt','r')

Or:

f = open('f:/Python 3.6/test.txt','r')

Change \ to /, or \\, because \t is a newline character in Python and is not recognized.

Method two :(I made a mistake here)

It is best to enter the path manually rather than copy and paste the changes directly.

Read More: