What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-24 11:45:01
how to load cifar10 in python
"""Load from /home/USER/data/cifar10 or elsewhere; download if missing.""" import tarfile import os from urllib.request import urlretrieve import numpy as np def cifar10(path=None): r"""Return (train_ima... Add solution -
Python 2022-03-18 05:30:14
How can I get terminal output in python
>>> import subprocess >>> cmd = [ 'echo', 'arg1', 'arg2' ] >>> output = subprocess.Popen( cmd, stdout=subprocess.PIPE ).communicate()[0] >>> print output arg1 arg2 >>> There is a bug in using of the subproc... Add solution -
Python 2022-03-17 02:55:04
Write a python program to find the longest words.
def longestword(filename): with open(filename,'r+') as f: words = f.read().split() max_len_word = max(words,key=len) max_len = len(max(words,key=len)) print('maximum lenth word in file :',max_len_word) print('lenth is : ',max_len) longestwor... Add solution -
Python 2022-02-26 22:10:05
python rsa
import Crypto from Crypto.PublicKey import RSA from Crypto import Random random_generator = Random.new().read key = RSA.generate(1024, random_generator) #generate public and private keys publickey = key.publickey # pub key export for exchange encrypted... Add solution -
Python 2022-02-18 04:15:02
cant read pdf file in python
#read file as rb mode file_path = f"E:\Project\ezzytrace\media\Invoices\Fedex_invoices\{file_name}" with open(file_path,'rb' ) as f: file_data = f.read() response = HttpResponse(file_data, content_type='application/pdf') ... Add solution -
Python 2022-01-23 09:50:27
how to scan directory recursively python
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 -
Java 2022-01-22 20:25:55
write a program to check whether the character is in lowercase or uppercase in java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Alphabet_Check { public static void main(String args[]) throws IOException{ char m; BufferedReader bf = new BufferedReader(new I... Add solution
Best helpers
Ranking is empty