About 50 results
Open links in new tab
  1. How to create a new text file using Python - Stack Overflow

    Feb 24, 2018 · How to create a new text file using Python Asked 7 years, 10 months ago Modified 3 months ago Viewed 381k times

  2. python - Create a file if it doesn't exist - Stack Overflow

    Mar 5, 2016 · I'm trying to open a file, and if the file doesn't exist, I need to create it and open it for writing:

  3. python - Automatically creating directories with file output - Stack ...

    Automatically creating directories with file output [duplicate] Asked 13 years, 3 months ago Modified 3 years, 5 months ago Viewed 542k times

  4. python - How do I write JSON data to a file? - Stack Overflow

    How do I write JSON data stored in the dictionary data to a file? f = open ('data.json', 'wb') f.write (data) This gives the error: TypeError: must be string or buffer, not dict

  5. How to create a file name with the current date & time in Python?

    A safer way to create your path, might be: folder_to_save_files = shutil.os.path.join(drive_letter, folder_name +folder_time) (also an import shutil statement can replace the import os statement )

  6. Create a .csv file with values from a Python list - Stack Overflow

    Jan 18, 2010 · To create and write into a csv file The below example demonstrate creating and writing a csv file. to make a dynamic file writer we need to import a package import csv, then need to create …

  7. How do I create a temporary directory in Python?

    Jul 11, 2010 · 24 The docs suggest using the TemporaryDirectory context manager, which creates a temporary directory, and automatically removes it when exiting the context manager. Using pathlib 's …

  8. python - How to create a zip archive of a directory? - Stack Overflow

    Dec 6, 2009 · 69 How can I create a zip archive of a directory structure in Python? In a Python script In Python 2.7+, shutil has a make_archive function.

  9. Create empty file using python - Stack Overflow

    Closed 10 years ago. I'd like to create a file with path x using python. I've been using os.system(y) where y = 'touch %s' % (x). I've looked for a non-directory version of os.mkdir, but I haven't been …

  10. python - How do I copy a file? - Stack Overflow

    How do I copy a file in Python? copy2(src,dst) is often more useful than copyfile(src,dst) because: it allows dst to be a directory (instead of the complete target filename), in which case the basename of …