About 590,000 results
Open links in new tab
  1. 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 …

  2. python - How do I access command line arguments? - Stack …

    I highly recommend argparse which comes with Python 2.7 and later. The argparse module reduces boiler plate code and makes your code more robust, because the module handles all …

  3. python - Extracting extension from filename - Stack Overflow

    Nov 23, 2019 · 12 Extracting extension from filename in Python Python os module splitext () splitext () function splits the file path into a tuple having two values – root and extension.

  4. Newest 'python' Questions - Stack Overflow

    1 day ago · Python is an interpreted, interactive, object-oriented (using classes), dynamic and strongly typed programming language that is used for a wide range of applications.

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

  6. python - How can I add new keys to a dictionary? - Stack Overflow

    How do I add a new key to an existing dictionary? It doesn't have an .add () method.

  7. python - if/else in a list comprehension - Stack Overflow

    How do I convert the following for-loop containing an if/else into a list comprehension? results = [] for x in xs: results.append(f(x) if x is not None else '') It should yield '' if x is None...

  8. Python: pass arguments to a script - Stack Overflow

    Apr 4, 2014 · You can use the sys module like this to pass command line arguments to your Python script.

  9. 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?

  10. 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?