About 79,800 results
Open links in new tab
  1. function - How to Open a file through python - Stack Overflow

    Oct 22, 2013 · I am very new to programming and the python language. I know how to open a file in python, but the question is how can I open the file as a parameter of a function?

  2. python - How to open a file using the open with statement - Stack …

    Python allows putting multiple open() statements in a single with. You comma-separate them. Your code would then be: def filter(txt, oldfile, newfile): '''\ Read a list of names from a file line …

  3. python - How to open a file for both reading and writing ... - Stack ...

    Oct 26, 2018 · The docs say that it truncates the file upon opening, so does that mean that if you use w+, you can't read what was originally in the file? If python were to crash while a file was …

  4. python - How to read pickle file? - Stack Overflow

    The following is an example of how you might write and read a pickle file. Note that if you keep appending pickle data to the file, you will need to continue reading from the file until you find …

  5. python - Errno 13 Permission denied - Stack Overflow

    Jul 16, 2020 · For future searchers, if none of the above worked, for me, python was trying to open a folder as a file. Check at the location where you try to open the file, if you have a folder …

  6. python - How to replace/overwrite file contents instead of …

    When you say "replace the old content that's in the file with the new content", you need to read in and transform the current contents data = file.read(). You don't mean "blindly overwrite it …

  7. Read file content from S3 bucket with boto3 - Stack Overflow

    May 8, 2025 · I read the filenames in my S3 bucket by doing objs = boto3.client.list_objects (Bucket='my_bucket') while 'Contents' in objs.keys (): objs_contents = objs ['Contents'] for i in r...

  8. OSError [Errno 22] invalid argument when use open() in Python

    I was trying to create a file with datetime inside, effectively a .txt named i.e - 2023-09-19 12:13:01.txt to create a reports file to store problems/results. As others mentioned before the …

  9. Unicode (UTF-8) reading and writing to files in Python

    See the codecs module for the list of supported encodings. So by adding encoding='utf-8' as a parameter to the open function, the file reading and writing is all done as utf8 (which is also …

  10. Quick and easy file dialog in Python? - Stack Overflow

    Feb 17, 2012 · I would like a quick and easy way to present a file selection dialog to the user, they can select the file, and then it's loaded to the database. (In my use case, if they happened to …

Refresh