Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Need help: Compiling Python-Code &In-Reply-To=

Thread Tools

Need help: Compiling Python-Code &In-Reply-To=

Posts: n/a

I'm looking to append several text files in one director and out put the combined files into another director. I'm new to Python and just can't get it to work. So far I've been able to create a file in the desired directory but it isn't pulling any of the data in the originating directory. Could please look at my code and tell me what I'm doing wrong.

import os,shutil
for r,d,fi in os.walk("c:\\test"):
for files in fi:
if files.endswith(".txt"):

Any help would be great.


Craig Dalton
Business Applications Systems Analyst
Sentara Healthcare Systems
Information Technology Removed)

Reply With Quote
Gabriel Genellina
Posts: n/a
En Fri, 02 May 2008 18:39:36 -0300, Larry Bates <(E-Mail Removed)`>

> No real reason to get shutil involved in this.

....except memory usage; shutil.copyfileobj reads the input in chunks, but
your version reads the whole file in memory. Depending on the file sizes,
this might be an issue.

Gabriel Genellina

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Cross-compiling error when compiling 2.6.1... Garrett Cooper Python 0 02-24-2009 09:47 PM
Cross-compiling error when compiling 2.6.1... Garrett Cooper Python 0 02-24-2009 08:55 PM
Compiling when libedit is in path Is there a trick to compiling Ruby when libedit must exist in the search path? Can you statically link to readline 5.0 in some manner? -- Lon Baker Lon Baker Ruby 1 03-21-2005 08:57 AM
Need help!! (Compiling in KDevelop) Mike Wahler C++ 3 06-24-2004 05:30 AM
Learning c, need a little help with compiling. C Programming 4 02-16-2004 05:49 PM