About 51 results
Open links in new tab
  1. python - How do I check whether a file exists without exceptions ...

    How do I check whether a file exists, using Python, without using a try statement? Now available since Python 3.4, import and instantiate a Path object with the file name, and check the is_file method …

  2. python - Pythonic way to check if a file exists? - Stack Overflow

    Which is the preferred way to check if a file exists and if not create it?

  3. How do I check if a directory exists in Python? - Stack Overflow

    133 Python 3.4 introduced the pathlib module into the standard library, which provides an object oriented approach to handle filesystem paths. The is_dir() and exists() methods of a Path object can be used …

  4. How can I check if a file exists in python? [duplicate]

    Aug 6, 2019 · I am trying to make a python script to make entries in an excel file that will have daily entries. I want to check if a file exists then open it. if the file does not exist then I want to make a ne...

  5. Check and wait until a file exists to read it - Stack Overflow

    Feb 13, 2015 · # read file else: raise ValueError("%s isn't a file!" % file_path) You wait a certain amount of time after each check, and then read the file when the path exists. The script can be stopped with …

  6. ¿Cómo verificar que un archivo exista en Python?

    Dec 6, 2015 · Usando Python, ¿cómo verifico si un archivo existe?, sin usar la sentencia try. Pregunta original: Check whether a file exists using Python de spence91

  7. python - Writing to a new file if it doesn't exist, and appending to a ...

    If the file with that specific username already exists, then the program should append to the file (so that you can see more than one highscore). And if a file with that username doesn't exist (for example, if …

  8. Most pythonic way to delete a file which may not exist

    Jun 1, 2012 · I want to delete the file filename if it exists. Is it proper to say if os.path.exists(filename): os.remove(filename) Is there a better way? A one-line way?

  9. open() in Python does not create a file if it doesn't exist

    Jun 3, 2010 · The file pointer is at the end of the file if the file exists. The file opens in the append mode. If the file does not exist, it creates a new file for reading and writing. - Python file modes seek () …

  10. How to check if a file exists in python? - Stack Overflow

    Aug 2, 2011 · Closed 14 years ago. Possible Duplicate: Pythonic way to check if a file exists? How to check if a file exists in python? Scripting in Windows