Answers for "create file with python"

19

python write to file

with open(filename,"w") as f:
  f.write('Hello World')
Posted by: Guest on March-30-2020
0

make a file in python

import os
 
newpath = r'C:Program Filesarbitrary' 
if not os.path.exists(newpath):
    os.makedirs(newpath)
Posted by: Guest on August-08-2021

Code answers related to "create file with python"

Python Answers by Framework

Browse Popular Code Answers by Language