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

  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. python - SSL: CERTIFICATE_VERIFY_FAILED with Python3 - Stack Overflow

    Sep 2, 2017 · Go to the folder where Python is installed, e.g., in my case (Mac OS) it is installed in the Applications folder with the folder name 'Python 3.6'. Now double click on 'Install Certificates.command'.

  4. python - How to concatenate (join) items in a list to a single string ...

    Sep 17, 2012 · For handling a few strings in separate variables, see How do I append one string to another in Python?. For the opposite process - creating a list from a string - see How do I split a …

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

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

  7. python - Find the current directory and file's directory - Stack Overflow

    How do I determine: the current directory (where I was in the shell when I ran the Python script), and where the Python file I am executing is?

  8. python - How do I pad a string with zeros? - Stack Overflow

    How do I pad a numeric string with zeroes to the left, so that the string has a specific length?

  9. python - How can I install cv2? - Stack Overflow

    Sep 11, 2019 · 32 My environment: Ubuntu 18.04 LTS (Bionic Beaver) (also tried on Ubuntu 19.04 (Disco Dingo)) I use/need Python 3 (3.6.8 installed). I need cv2, which is a model of OpenCV. I tried …

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