What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-05 19:00:29
Python Program to Count the Occurrences of a Word in a Text File
#get file object reference to the file file = open("C:\workspace\python\data.txt", "r") #read content of file to string data = file.read() #get number of occurrences of the substring in the string occurrences = data.count("python&... Add solution -
Python 2022-02-26 06:00:04
twilio rest api "5.7" python sms example
from twilio.rest import TwilioRestClient import twilio print twilio.__version__ # Your Account SID from twilio.com/console account_sid = "AC6791725bc93116fbd42b4cd477996f7d" # Your Auth Token from twilio.com/console auth_token = "30ed212f6... Add solution -
Javascript 2022-02-02 23:06:12
8.2. Working With Arrays 8.2.1. Bracket Notation and Index
//Use bracket notation and index to access items in an array. let programmingLanguages = [ "JavaScript", // index 0 "Python", // index 1 "Java", // index 2 "C#" // index 3 ]; console.... Add solution -
Python 2022-02-02 18:10:13
check if 2 strings are equal python
str1 == str2 # return True if the strings are equals. Case sensitive ! str1 = "python" str2 = "python" str1 == str2 # True str1 = "python" str2 = "javascript" str1 == str2 # False str1 = "python" str2 = ... Add solution -
Python 2022-01-31 23:52:46
python read a directory to get all files in sub folders
import os path ="C:/workspace/python" #we shall store all the file names in this list filelist = [] for root, dirs, files in os.walk(path): for file in files: #append the file name to the list filelist.append(os.path.join(root,file)... Add solution