Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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")
Comment

create file in a specific directory python

f = open(r"C:Test.py", "a")
Comment

PREVIOUS NEXT
Code Example
Python :: how to declare a class in python 
Python :: bar plot group by pandas 
Python :: python run code at the same time 
Python :: create dictionary 
Python :: df insert 
Python :: Spotify API Authentication in Python 
Python :: how to get what type of file a file is in python 
Python :: how to make your own range function in python 
Python :: detailview 
Python :: how to correlation with axis in pandas 
Python :: numpy array serialize to string 
Python :: how to create an integer validate python 
Python :: python read binary 
Python :: take first 10 row while reading csv python 
Python :: list to csv python 
Python :: Publish Image msg ros python 
Python :: python number of elements in list of lists 
Python :: how to install package offline 
Python :: python list to dict 
Python :: how to return a missing element in python 
Python :: python discord mention user 
Python :: Python Add a string in a certain position 
Python :: plt add y gridlines 
Python :: python import file from different directory 
Python :: python print function 
Python :: delete variable python 
Python :: how to stop auto restart flask python 
Python :: subscript in python 
Python :: list to dataframe columns 
Python :: executing curl commands in python 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =