Answers for "how to find python"

7

how to find where python is located

>>> import os
>>> import sys
>>> os.path.dirname(sys.executable)
'C:\Python25'
Posted by: Guest on May-28-2020
3

find python path windows

>>> import os
>>> import sys
>>> os.path.dirname(sys.executable)
'C:\Python25'
Posted by: Guest on December-09-2020
0

find python

def find_all_indexes2(input_str, search_str):
    indexes = []
    index = input_str.find(search_str)

    while index != -1:
        indexes.append(index)
        index = input_str.find(search_str, index+1)

    return indexes

print(find_all_indexes2("Can you can a can as a canner can can a can", "can"))
# returns [8, 14, 23, 30, 34, 40]
# Note: Capital "Can" was not found
Posted by: Guest on April-04-2021

Python Answers by Framework

Browse Popular Code Answers by Language