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

  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 …

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

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

  5. python - How to print without a newline or space - Stack Overflow

    For Python 2 and earlier, it should be as simple as described in Re: How does one print without a CR? by Guido van Rossum (paraphrased): Is it possible to print something, but not …

  6. How do I measure elapsed time in Python? - Stack Overflow

    The python cProfile and pstats modules offer great support for measuring time elapsed in certain functions without having to add any code around the existing functions.

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

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

  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 …