On Sun, Nov 16, 2014 at 2:45 PM, Abdul Abdul <abdul.s...@gmail.com> wrote: > I just came across the following line of code: > > outputfile = os.path.splitext(infile)[0] + ".jpg" > > Can you kindly explain to me what those parts mean?
>>> import os.path >>> help(os.path.splitext) Help on function splitext in module ntpath: splitext(p) Split the extension from a pathname. Extension is everything from the last dot to the end, ignoring leading dots. Returns "(root, ext)"; ext may be empty. >>> os.path.splitext('test.txt') ('test', '.txt') >>> os.path.splitext('test.txt')[0] 'test' >>> os.path.splitext('test.txt')[0] + ".jpg" 'test.jpg' -- https://mail.python.org/mailman/listinfo/python-list