file_path =(r'i:\vacpy\ch10\pi_digits.txt') #將文件路徑存儲在變量file_path中
with open (file_path) as file_object:
contents = file_object.read()
print(contents)
"""windows system 有時能夠正確地解讀文件路徑中的斜桿。如果你使用的是windows system,且結果不符合
預期,請確保文件路徑中使用的是反斜桿。另外,由於反斜桿在python中被視為轉義標記,為在windows中確保萬無一失
,應以原始字符串的方式指定路徑,即在開頭的單引號前加上字母“r” """
