Last active
May 4, 2019 01:40
-
-
Save benoitguigal/32341a2930dbc2f619c05acdf269bc3a to your computer and use it in GitHub Desktop.
Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get all letters of the alphabet | |
import string | |
all_letters = string.ascii_letters + " .,;'" | |
# List all files in a directory matching a pattern | |
import glob | |
def findFiles(path): return glob.glob(path) | |
findFiles("/somedir/*.txt") | |
# Get the name of a file, stripping the extension | |
name = os.path.splitext(os.path.basename(filename))[0] | |
# Find the index of char in a string | |
"abcdef".find("b") | |
# Generator for dict | |
{x: datasets.ImageFolder(os.path.join(data_dir, x), data_transforms[x]) | |
for x in ['train', 'val']} | |
# Get pip tags compatible with your platform | |
import pip | |
pip.pep425tags.get_supported() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment