On 01/10/13 19:21, Elise Rosa wrote:
Hello!
I'm using Python in SPSS to rename and arrange some files. The setup is
this: I have many .txt files in a folder, and I'd like to first remove
part of their names. Next, I need to paste the second and third columns
from each .txt file into another document (could be an excel sheet), and
match them all by the first column in each .txt file (subject number). I
also need to rename the second and third columns when they are going
into the excel file with the name of the .txt file they came from.
Doesn't look like SPSS is particularly significant it's
just text file manipulation. Given you mention the data
being in columns and you want to manipulate the column
names it sounds like the CSV module should be able to help.
Are you familiar or have you looked at csv yet?
If not take a look at the docs then come back with any
questions.
For manipulating file names the standard os/path/shutil
modules should provide all you need combined with some string
processing.
HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor