Skip to content

Instantly share code, notes, and snippets.

@Kienyew
Created October 31, 2020 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kienyew/3ee127308185099806680c2bcb185a34 to your computer and use it in GitHub Desktop.
Save Kienyew/3ee127308185099806680c2bcb185a34 to your computer and use it in GitHub Desktop.
My Interactive Python startup script
import os
import sys
import itertools
import collections
import subprocess
import random
import bisect
from math import *
from fractions import Fraction
from pathlib import Path
import pprint
import re
import cmath
import struct
import time
import datetime
import decimal
from decimal import Decimal
from os import chdir as cd
import functools
import math
import pathlib
import string
import typing
from typing import *
import statistics
from collections import Counter
import unicodedata
import json
class __:
def __iter__(self):
yield from sorted(os.listdir('.'))
def __str__(self):
return str(list(self))
def __repr__(self):
return pprint.pformat(list(self))
def __getitem__(self, index):
return pathlib.Path(list(self)[index])
def __call__(self, path):
if Path(path).is_dir():
return list(Path(path).glob('*'))
else:
return [Path(path)]
l = ll = ls = __()
P = Path
del __
lmap = lambda f, it: list(map(f, it))
lfilter = lambda f, it: list(filter(f, it))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment