What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-04 18:38:13
get file in file zip python
from zipfile import ZipFile import os def getfilespath(filename): dir = os.path.dirname(__file__) return os.path.join(dir, filename) path = getfilespath("bbc-fulltext.zip") archive = ZipFile(path, 'r') files = archive.namelist() Add solution -
Other 2021-11-04 12:01:14
Considering the Census Income data with response variable as Income(>50k and <=50k).
def load_dataset(path, urls): if not os.path.exists(path): os.mkdir(path) for url in urls: data = requests.get(url).content filename = os.path.join(path, os.path.basename(url)) with open(filename, "wb") as file:... Add solution -
Python 2021-11-02 07:24:07
copy image from one folder to another in python
import glob import shutil import os src_dir = "your/source/dir" dst_dir = "your/destination/dir" for jpgfile in glob.iglob(os.path.join(src_dir, "*.jpg")): shutil.copy(jpgfile, dst_dir) Add solution -
Python 2021-10-30 03:22:08
python script to read all file names in a folder
import os def get_filepaths(directory): """ This function will generate the file names in a directory tree by walking the tree either top-down or bottom-up. For each directory in the tree rooted at directory top (includin... Add solution -
Python 2021-10-28 18:53:09
python outlook download attachment
import win32com.client #pip install pypiwin32 to work with windows operating sysytm import datetime import os # To get today's date in 'day-month-year' format(01-12-2017). dateToday=datetime.datetime.today() FormatedDate=('{:02d}'.format(dateToday.day)+'... Add solution