Answers for "how do i create a file in specific folder in python"

0

how do i create a file in specific folder in python

import os

filepath = os.path.join('c:/your/full/path', 'filename')
if not os.path.exists('c:/your/full/path'):
    os.makedirs('c:/your/full/path')
f = open(filepath, "a")
Posted by: Guest on March-28-2022

Code answers related to "how do i create a file in specific folder in python"

Python Answers by Framework

Browse Popular Code Answers by Language