Skip to content

Instantly share code, notes, and snippets.

@0x48piraj
Last active December 14, 2023 05:36
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 0x48piraj/3b3f9f3423a305f9082cbaba1062075f to your computer and use it in GitHub Desktop.
Save 0x48piraj/3b3f9f3423a305f9082cbaba1062075f to your computer and use it in GitHub Desktop.
Random scripts and procedures in a nice little package.
def citup(lst):
"""
chunk-it-up: break a list into n-sized chunks
"""
return [lst[i:i+n] for i in range(0, len(lst), n)]
mixedlol = [["a", 500, datetime.datetime], ["b", 1000, datetime.datetime], ["C", 1500, datetime.datetime]] # list of lists
def hoelol(mixedlol):
"""
Edit heterogeneous list of lists selectively
"""
lst = []
for idx, (name,price,date) in enumerate(mixedlol):
lst.append([name.lower(),price,date])
return lst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment