What do you want to save?
Add Code snippet
New code examples
-
Other 2021-10-03 12:39:02
'builtin_function_or_method' object is not subscriptable
# Imports import speech_recognition as sr import os import time import datetime import warnings import calendar import subprocess import sys import random import wikipedia from gtts import gTTS #Information yourname = "Jimmy" preferedname = &qu... Add solution -
Python 2021-10-03 10:01:03
how to find the indexes of a substring in a string in python
import re # matches_position_start will be a list of starting index positions matches_start = re.finditer(word.lower(), string.lower()) matches_position_start = [match.start() for match in matches_start] # matches_position_end will be a list of ending in... Add solution -
Python 2021-10-01 11:33:06
ping server status on python
import platform # For getting the operating system name import subprocess # For executing a shell command def ping(host): """ Returns True if host (str) responds to a ping request. Remember that a host may not respond to a ... Add solution -
Other 2021-09-30 18:49:02
Simple dictionary in Python
import string # Edited by Sadman Sakib dic = {'greet': 'something that you say or do to greet somebody', 'sleep': ' [intransitive] to rest with your eyes closed and your mind and body not active', 'morning': 'The early part of the day from... Add solution -
Python 2021-09-28 10:56:03
Python Enemy NPC CLass
#!/usr/bin/env python3 import random class Enemy(): def __init__(self,ancestry,gear): self.enemy=ancestry self.weapon=gear self.hp=random.randrange(10,20) ... Add solution -
Python 2021-09-27 16:26:02
python change window focus
import win32gui def windowEnumerationHandler(hwnd, top_windows): top_windows.append((hwnd, win32gui.GetWindowText(hwnd))) if __name__ == "__main__": results = [] top_windows = [] win32gui.EnumWindows(windowEnumerationHandler, t... Add solution -
Python 2021-09-25 22:34:02
string methods to clean column dataframe
def clean_col(col): col = col.strip() col = col.replace("(","") col = col.replace(")","") col = col.lower() return col new_columns = [] for c in df.columns: clean_c = clean_col(c) new_co... Add solution