Hello Everyone
Iam working with Visual Studio Code and got the Error OSError: [Errno 9] Bad file descriptor.
When I run the file on my GitHub account, its running, but on my Laptop occurs the Error.
Do you have any clue for me?
Error Message:
Traceback (most recent call last):
File “d:\Markus\00_Documents\20_Bildung\60_Self_Online_Study\60_Programmieren\10_Python\100_programme_2.py”, line 1124, in
Workfile(r"D:\Markus\00_Documents\text3.txt")
File “d:\Markus\00_Documents\20_Bildung\60_Self_Online_Study\60_Programmieren\10_Python\100_programme_2.py”, line 1120, in Workfile
file2.close()
OSError: [Errno 9] Bad file descriptor
Program:
def Workfile(file):
with open(file,"r") as file1:
with open(r"D:\Markus\00_Documents\text4.txt","w") as file2:
for row in file1:
file2.write(row.rstrip("\n"))
file2.close()
file1.close()
Workfile(r"D:\Markus\00_Documents\text3.txt")