Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80911 > unrolled thread
| Started by | Tim Chase <python.list@tim.thechases.com> |
|---|---|
| First post | 2014-11-16 15:53 -0600 |
| Last post | 2014-11-16 15:53 -0600 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: What does this line of code mean? Tim Chase <python.list@tim.thechases.com> - 2014-11-16 15:53 -0600
| From | Tim Chase <python.list@tim.thechases.com> |
|---|---|
| Date | 2014-11-16 15:53 -0600 |
| Subject | Re: What does this line of code mean? |
| Message-ID | <mailman.15907.1416174686.18130.python-list@python.org> |
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
Back to top | Article view | comp.lang.python
csiph-web