[Tutor] raw_input a directory path

Hugo Arts hugo.yoshi at gmail.com
Fri May 14 01:06:49 CEST 2010


On Fri, May 14, 2010 at 12:17 AM, Spencer Parker <inthefridge at gmail.com> wrote:
> 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
>

As was noted, raw_input doesn't want escaping done on its input, it
just takes it as is. Escaping is something done only for
representation purposes. If you want your script to replace a vertical
tab, you'll need to enter a vertical tab character into your console.
To be fair, it's not immediately obvious how to do that. I must
confess I have no idea how you would do that on windows[1]

Alternatively, you could change your script so that you can, for
example, enter the corresponding ASCII code as input (the chr function
can convert ascii codes to their corresponding character).

Hugo

[1] had you been using linux I would have suggested:
$ echo -e '\v' | xclip -i -selection c
Then just paste as input. It's not exactly convenient, but does solve
the problem.


More information about the Tutor mailing list