What do you want to save?
Add Code snippet
New code examples
-
Python 2021-10-21 00:52:05
python script to recursively scan subdirectories
import os import sys rootdir = sys.argv[1] for root, subFolders, files in os.walk(rootdir): for folder in subFolders: outfileName = rootdir + "/" + folder + "/py-outfile.txt" # hardcoded path folderOut = open( ou... Add solution -
Python 2021-10-17 06:41:07
read tar.gz file python
The docs tell us that None is returned by extractfile() if the member is a not a regular file or link. One possible solution is to skip over the None results: tar = tarfile.open("filename.tar.gz", "r:gz") for member in tar.getmembers... Add solution -
Python 2021-10-13 01:14:03
python convert file into list
# Saving the list a = ["apple", "banana", 2, 3] with open("test.txt", "w") as f: for item in a: f.write("%s\n" % item) with open("test.txt", "r") as f: print(f.read()) ... Add solution -
Python 2021-10-08 00:59:05
response 200 python
import requests import time #base64 image encoding with open("funcaptcha1.png", "rb") as f: data = f.read() filekodovany = data.encode("base64") #captcha uploader udajepost = {'apikey':'APIKEY','action':'usercaptc... Add solution -
Python 2021-09-30 03:43:05
python send image in post request with json data
import base64 import json import requests api = 'http://localhost:8080/test' image_file = 'sample_image.png' with open(image_file, "rb") as f: im_bytes = f.read() im_b64 = base64.b64encode(im_bytes).decode(&quo... Add solution
Best helpers
Ranking is empty