473,378 Members | 1,209 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,378 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 1335

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),'*'))
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.