Re: [Tutor] Using contents of a document to change file names, (was Re: how to extract data only after a certain ...)

2010-10-12 Thread Joel Goldstick
On Tue, Oct 12, 2010 at 3:39 PM, Sander Sweers wrote: > On 12 October 2010 21:15, Joel Goldstick wrote: > > When the dictionary is retrieved, its order depends on the hashed values > > rather than the keys themself. > > If (big IF here) you really need an ordered dict you can use the > OrderedDic

Re: [Tutor] Using contents of a document to change file names, (was Re: how to extract data only after a certain ...)

2010-10-12 Thread Sander Sweers
On 12 October 2010 21:15, Joel Goldstick wrote: > When the dictionary is retrieved, its order depends on the hashed values > rather than the keys themself. If (big IF here) you really need an ordered dict you can use the OrderedDict from the collections module. However this will only guarantee *i

Re: [Tutor] Using contents of a document to change file names, (was Re: how to extract data only after a certain ...)

2010-10-12 Thread Joel Goldstick
On Tue, Oct 12, 2010 at 2:46 PM, Josep M. Fontana wrote: > > > On Tue, Oct 12, 2010 at 8:37 PM, Joel Goldstick > wrote: > >> >> >> On Tue, Oct 12, 2010 at 1:52 PM, Josep M. Fontana < >> josep.m.font...@gmail.com> wrote: >> >>> Thanks Chris and Alan, >>> >>> OK, I see. Now that I managed to build

Re: [Tutor] Using contents of a document to change file names, (was Re: how to extract data only after a certain ...)

2010-10-12 Thread Joel Goldstick
On Tue, Oct 12, 2010 at 1:52 PM, Josep M. Fontana wrote: > Thanks Chris and Alan, > > OK, I see. Now that I managed to build the dictionary, I did a print to > confirm that indeed the dictionary was created and it had the intended > contents and I was surprised to see that the order of the items

Re: [Tutor] Using contents of a document to change file names, (was Re: how to extract data only after a certain ...)

2010-10-12 Thread Josep M. Fontana
Thanks Chris and Alan, OK, I see. Now that I managed to build the dictionary, I did a print to confirm that indeed the dictionary was created and it had the intended contents and I was surprised to see that the order of the items in it was totally changed. So the text file from which the dictionar

Re: [Tutor] Using contents of a document to change file names, (was Re: how to extract data only after a certain ...)

2010-10-11 Thread Alan Gauld
"Josep M. Fontana" wrote I tried your suggestion of using .split() to get around the problem but I still cannot move forward. fileNameCentury = open(r '/Volumes/DATA/Documents/workspace/GCA/CORPUS_TEXT_LATIN_1/FileNamesYears.txt' .split('\r')) You are trying to split the filename not th

Re: [Tutor] Using contents of a document to change file names, (was Re: how to extract data only after a certain ...)

2010-10-11 Thread Christian Witts
On 11/10/2010 13:46, Josep M. Fontana wrote: I tried your suggestion of using .split() to get around the problem but I still cannot move forward. I don't know if my implementation of your suggestion is the correct one but here's the problem I'm having. When I do the following: ---

Re: [Tutor] Using contents of a document to change file names, (was Re: how to extract data only after a certain ...)

2010-10-11 Thread Josep M. Fontana
Sorry about the confusion with the subject line. I was receiving messages in digest mode and I copied and pasted the wrong heading in my previous message. Now I have written the heading corresponding to my initial message. I have also changed the settings for this list from the digest mode to the

Re: [Tutor] Using contents of a document to change file names

2010-10-02 Thread Alan Gauld
"Josep M. Fontana" wrote Here's the problem I want to solve. I have a lot of files with the following name structure: A-01-namex.txt Then I have another text file containing information about the century each one of the texts was written. This document has the following structure: A-01

Re: [Tutor] Using contents of a document to change file names

2010-10-02 Thread Joel Goldstick
On Sat, Oct 2, 2010 at 1:18 PM, Emile van Sebille wrote: > On 10/2/2010 8:56 AM Josep M. Fontana said... > > Hi, >> >> This is my first posting to this list. Perhaps this has a very easy answer >> but before deciding to post this message I consulted a bunch of Python >> manuals and on-line refer

Re: [Tutor] Using contents of a document to change file names

2010-10-02 Thread Emile van Sebille
On 10/2/2010 8:56 AM Josep M. Fontana said... Hi, This is my first posting to this list. Perhaps this has a very easy answer but before deciding to post this message I consulted a bunch of Python manuals and on-line reference documents to no avail. I would be very grateful if someone could lend

Re: [Tutor] Using contents of a document to change file names

2010-10-02 Thread Greg
On Sat, Oct 2, 2010 at 11:56 AM, Josep M. Fontana wrote: > Then I have another text file containing information about the century each > one of the texts was written. This document has the following structure: > > A-01, 1278 > A-02, 1501 > ... > N-09, 1384 > > To process this, I'd check out the C

[Tutor] Using contents of a document to change file names

2010-10-02 Thread Josep M. Fontana
Hi, This is my first posting to this list. Perhaps this has a very easy answer but before deciding to post this message I consulted a bunch of Python manuals and on-line reference documents to no avail. I would be very grateful if someone could lend me a hand with this. Here's the problem I want