About 577,000 results
Open links in new tab
  1. python - How do I list all files of a directory? - Stack Overflow

    Jul 9, 2010 · How can I list all files of a directory in Python and add them to a list?

  2. python - Iterating over a dictionary using a 'for' loop, getting keys ...

    Mar 16, 2017 · In Python 3, the iteration has to be over an explicit copy of the keys (otherwise it throws a RuntimeError) because my_dict.keys() returns a view of the dictionary keys, so any change to …

  3. How can I set up a virtual environment for Python in Visual Studio …

    Jan 9, 2019 · In my project folder I created a venv folder: python -m venv venv When I run command select python interpreter in Visual Studio Code, my venv folder is not shown. I went one level up like …

  4. How can I find where Python is installed on Windows?

    Mar 15, 2009 · I want to find out my Python installation path on Windows. For example: C:\\Python25 How can I find where Python is installed?

  5. Python command not working in command prompt [duplicate]

    When I type python into the command line, the command prompt says python is not recognized as an internal or external command, operable program, or batch file. What should I do? Note: I have Python...

  6. 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

  7. python - Where does pip install its packages? - Stack Overflow

    May 1, 2015 · I activated a virtualenv which has pip installed. I did pip3 install Django==1.8 and Django successfully downloaded. Now, I want to open up the Django folder. Where is the folder located? …

  8. python - Find a value in a list - Stack Overflow

    In Python 3, filter doesn't return a list, but a generator-like object. Finding the first occurrence If you only want the first thing that matches a condition (but you don't know what it is yet), it's fine to use a for …

  9. python - Importing files from different folder - Stack Overflow

    I have this folder structure: application ├── app │ └── folder │ └── file.py └── app2 └── some_folder └── some_file.py How can I import a function from file.py, from within som...

  10. python - Check if a given key already exists in a dictionary - Stack ...

    I wanted to test if a key exists in a dictionary before updating the value for the key. I wrote the following code: if 'key1' in dict.keys(): print "blah" else: print "boo" I think this is not...