Skip to content

Python code snippet – How to open a file in a different directory in mac?

import os
f = open (os.path.expanduser("~/Desktop/somedir/somefile.txt"))
See also  Python code snippet - How to make turtle invisible ?
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.