473,387 Members | 1,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Re: Nested os.path.join()'s

On Mon, 05 May 2008 16:28:33 +0200, Paul Scott <ps****@uwc.ac.zawrote:
>
On Mon, 2008-05-05 at 16:21 +0200, Paul Scott wrote:
>example:

if os.path.exists(os.path.join(basedir,picdir)) == True :
blah blah

Sorry, pasted the wrong example...

Better example:

pics = glob.glob(os.path.join(os.path.join(basedir,picdir ),'*'))

>Question is, is there a better way of doing this? The above *works* but
it looks kinda hackish...
How about not nesting the calls?
>>from os.path import join
join(join('x', 'y'), 'z') == join('x', 'y', 'z')
True
>>>
Jean-Paul
Jun 27 '08 #1
0 1337

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: jbm05 | last post by:
Hi, I'm curious about the computational complexity of a query I have. The query contains multiple nested self left joins, starting with a simple select, then doing a self left join with the...
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
2
by: smauldin | last post by:
Why does the execution plan have a nested loop join for a simple select with an UDF in the where clause? Here is the query: select * from test_plan where vCol = my_udf('test') Here is the...
12
by: coosa | last post by:
Dear all, I have table called CATEGORY, which is defined as follows: CREATE TABLE CATEGORY ( CATEGORY_ID INTEGER IDENTITY(1,1) NOT NULL, CATEGORY_NAME VARCHAR(40) NOT NULL CONSTRAINT...
1
by: tsuraan | last post by:
Supposing that I have a directory tree like so: a/ __init__.py b/ __init__.py c.py and b.py has some method (let's call it d) within it. I can, from python, do:
2
by: Gigs_ | last post by:
i have this function. def f(start): stack = def f1(start): for fname in os.listdir(startDir): path = os.path.join(startDir, fname) if os.path.isfile(path): stack.append(path) else:
1
by: crybaby | last post by:
when I do this in my python code and run it in windows xp, it creates ctemp/..../.../.../../ so on and creates file t. Not file starting with the name complist and ending with .txt...
2
by: Paul Scott | last post by:
Today, I needed to concatenate a bunch of directory paths and files together based on user input to create file paths. I achieved this through nested os.path.join()'s which I am unsure if this is a...
0
by: Paul Scott | last post by:
On Mon, 2008-05-05 at 16:21 +0200, Paul Scott wrote: Sorry, pasted the wrong example... Better example: pics = glob.glob(os.path.join(os.path.join(basedir,picdir),'*'))
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.