Raw strings as input from File?
Rhodri James
rhodri at wildebst.demon.co.uk
Tue Nov 24 20:16:15 EST 2009
On Wed, 25 Nov 2009 01:11:29 -0000, Rhodri James
<rhodri at wildebst.demon.co.uk> wrote:
> On Tue, 24 Nov 2009 21:20:25 -0000, utabintarbo <utabintarbo at gmail.com>
> wrote:
>
>> On Nov 24, 3:27 pm, MRAB <pyt... at mrabarnett.plus.com> wrote:
>>>
>>> .readlines() doesn't change the "\10" in a file to "\x08" in the string
>>> it returns.
>>>
>>> Could you provide some code which shows your problem?
>>
>> Here is the code block I have so far:
>> for l in open(CONTENTS, 'r').readlines():
>> f = os.path.splitext(os.path.split(l.split('->')[0]))[0]
>> if f in os.listdir(DIR1) and os.path.isdir(os.path.join(DIR1,f)):
>> shutil.rmtree(os.path.join(DIR1,f))
>> if f in os.listdir(DIR2) and
>> os.path.isdir(os.path.join(DIR2,f)):
>> shutil.rmtree(os.path.join(DIR2,f))
>
> Ahem. This doesn't run. os.path.split() returns a tuple, and calling
> os.path.splitext() doesn't work.
I meant, "doesn't work on a tuple". Sigh. It's been one of those days.
--
Rhodri James *-* Wildebeest Herder to the Masses
More information about the Python-list
mailing list