What do you want to save?
Add Code snippet
New code examples
-
Python 2021-10-26 19:59:13
Write a Python program to read a file line by line store it into an array
def conftolist(fname,mode='r+'): with open(fname) as f: lines = [line.strip() for line in f] print(lines) conftolist('file1.txt') ############ with open('file1.txt','r+') as f: # li = list(f) # print(li) ls=[] for l in f: ls.append(l.strip())... Add solution -
Other 2021-10-21 20:19:13
Onject ssd detection code
import cv2thres = 0.45 # Threshold to detect objectcap = cv2.VideoCapture(1)cap.set(3,1280)cap.set(4,720)cap.set(10,70)classNames= []classFile = 'coco.names'with open(classFile,'rt') as f: classNames = f.read().rstrip('\n').split('\n')configPath = 'ssd... Add solution -
Javascript 2021-10-20 03:05:03
load_jsonl
# https://medium.com/@galea/how-to-love-jsonl-using-json-line-format-in-your-workflow-b6884f65175b import json def dump_jsonl(data, output_path, append=False): """ Write list of objects to a JSON lines file. """ ... Add solution -
Other 2021-10-19 21:54:02
python covert vtt subtittle to text txt file
import re bad_words = ['-->','</c>'] with open('example.en.vtt') as oldfile, open('newfile.txt', 'w') as newfile: for line in oldfile: if not any(bad_word in line for bad_word in bad_words): newfile.write(line) with o... Add solution -
Python 2021-10-19 09:38:10
trim string python
string =' abc ' # After removing leading whitespace print(string.lstrip()); # Output: 'abc ' # After removing trailing whitespace print(string.rstrip()); # Output: ' abc' # After removing all whitespace print(string.strip()); # Output: 'abc' Add solution