Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:code': 0.07; 'cc:addr:python-list': 0.11; 'changes': 0.15; '(without': 0.16; '-tkc': 0.16; 'extension.': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'received:174.136': 0.16; 'splits': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'extension': 0.26; 'code:': 0.26; 'header:In- Reply-To:1': 0.27; 'tried': 0.27; 'them?': 0.31; 'url:python': 0.33; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'received:10': 0.37; 'skip:o 20': 0.38; 'url:library': 0.38; 'whatever': 0.38; 'explain': 0.39; 'kindly': 0.61; 'first': 0.61; 'to:addr:gmail.com': 0.65; 'subject:this': 0.83; 'url:path': 0.84 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1416174674891:1447491062 X-MC-Ingress-Time: 1416174674891 Date: Sun, 16 Nov 2014 15:53:53 -0600 From: Tim Chase To: Abdul Abdul Subject: Re: What does this line of code mean? In-Reply-To: References: X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AuthUser: tim@thechases.com Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416174686 news.xs4all.nl 2845 [2001:888:2000:d::a6]:47607 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80911 On 2014-11-16 22:45, Abdul Abdul 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? Have you tried them? https://docs.python.org/2/library/os.path.html#os.path.splitext This takes a path and splits it into everything-but-the-extension, and the extension. The "[0]" takes the first part (without the extension), and the "+ '.jpg'" part tacks on that extension. So it changes whatever the existing extension is to .jpg -tkc