Home > Blockchain >  I can't access the file
I can't access the file

Time:08-13

i started with two line code but when i run it keeps crashing and i don't know how to fix it. The programming language I am using is python enter image description here

CodePudding user response:

The interpreter understands \f and \b as some special characters, that is why they are highlighted, you must escape backslashes like so: "D:\\files\\baitap.txt" or using a raw string r"D:\files\baitap.txt"

CodePudding user response:

What Daniel Said should work but you can also use this:

import os

  import os
  pwd = os.getcwd()
  file = open(pwd   "\\filepathhere.filetype")
  • Related