About 653,000 results
Open links in new tab
  1. What does the "at" (@) symbol do in Python? - Stack Overflow

    An @ symbol at the beginning of a line is used for class and function decorators: PEP 318: Decorators Python Decorators - Python Wiki The most common Python decorators are: …

  2. python - Why do some functions have underscores - Stack Overflow

    May 24, 2024 · In Python, the use of an underscore in a function name indicates that the function is intended for internal use and should not be called directly by users. It is a convention used …

  3. python - `from ... import` vs `import .` - Stack Overflow

    Feb 25, 2012 · I'm wondering if there's any difference between the code fragment from urllib import request and the fragment import urllib.request or if they are interchangeable. If they are …

  4. 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 …

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

  6. What does [:-1] mean/do in python? - Stack Overflow

    Mar 20, 2013 · Working on a python assignment and was curious as to what [:-1] means in the context of the following code: instructions = f.readline()[:-1] Have searched on here on S.O. …

  7. python - How can I access the index value in a 'for' loop ... - Stack ...

    The fastest way to access indexes of list within loop in Python 3.7 is to use the enumerate method for small, medium and huge lists. Please see different approaches which can be used to …

  8. What's the difference between "pip install" and "python -m pip …

    Sep 9, 2014 · I have a local version of Python 3.4.1 and I can run python -m pip install, but I'm unable to find the pip binary to run pip install. What's the difference between these two?

  9. How do I declare custom exceptions in modern Python?

    By "modern Python" I mean something that will run in Python 2.5 but be 'correct' for the Python 2.6 and Python 3.* way of doing things. And by "custom" I mean an Exception object that can …

  10. 'Python not found' despite having been installed [duplicate]

    Feb 28, 2021 · I've installed Python's latest version. However, when I write in command prompts python --version I get: Python was not found; run without arguments to install from the …