Bash vs Python
A simple case study: It’s not about one programming language killing and replacing the other, its all about the purpose!
The scenario: Using convert to resize images, both in bash and python just for the fun of it.
First up is BASH: `**
mkdir -p resized
find. -name '_.jpg'_ -or -name '.png' -or -name '*.gif'</span>
-exec convert -resize 648x480 '{}'</span>
"resized/$(basename '{}')" ';'
**`
Its Pythons turn:
from glob import glob
from os.path import splitext
from os import system
if not path.exists('resized'):
mkdir('resized')
for pic in glob.glob('*'):
if os.path.splitext(pic)[1] in ext:
system('convert -resize 640x480 "%s" "resized/%s"'
% (pic,os.path.splitext(pic)[0]))
#javascript#linux
About Hemanth HM
Hemanth HM is a Sr. Machine Learning Manager at PayPal, Google Developer Expert, TC39 delegate, FOSS advocate, and community leader with a passion for programming, AI, and open-source contributions.