[Tutor] raw_input a directory path
Spencer Parker
inthefridge at gmail.com
Fri May 14 00:17:32 CEST 2010
In these files I also have some special characters I need to remove, but I
cannot figure out how to specify this.
I need to remove a vertical tab and a formfeed character. How would I
specify to remove these characters? I have tried \v and \f
On Thu, May 13, 2010 at 8:48 AM, Spencer Parker <inthefridge at gmail.com>wrote:
> I figured out the issue...for some reason it works with the trailing slash,
> but not without it. Once I do that...everything is all good...
>
>
> On Wed, May 12, 2010 at 8:00 PM, Dave Angel <davea at ieee.org> wrote:
>
>>
>>
>> Spencer Parker wrote:
>>
>>> Here is the code:
>>> http://dpaste.com/hold/193862/
>>>
>>> <http://dpaste.com/hold/193862/>It still isn't working for me. I don't
>>> see
>>> it hitting the first for loop or even the second one. It runs without an
>>> error at all.
>>>
>>> I am inputing the directory as: \\Documents\ and\
>>> Settings\\user\\Desktop\\test
>>>
>>>
>> When using raw_input(), no characters are substituted and none need
>> escaping. It's not a literal to need double-backslashing, and it's not a
>> Unix shell, to need escaping of the space character. What you type is what
>> you get, other than things like backspace and enter.
>>
>> Prove it to yourself with print, and then type it straight. You might
>> also add an extra (untested) :
>>
>> if not (os.path.exists(directory) and os.path.isdir(directory)):
>> print "Not a valid directory"
>>
>>
>> DaveA
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100513/d1fc72dd/attachment.html>
More information about the Tutor
mailing list