2 ms·
from string import capwords result = capwords(string) This does the split/capitalize/join dance, all in one. The file example you gave could also be turned
by sgarland 2y ago
from string import capwords
result = capwords(string)
This does the split/capitalize/join dance, all in one.
The file example you gave could also be turned into a dict comprehension if desired. I’m on mobile, but I think this would work.
result = { f:os.path.getsize(f) for f in glob.glob(“*”) if os.path.isfile(f) }