On 9 Jun 2006 17:44:42 -0700, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> actually, i am doing an application that allows user to delete files by
> entering an input pattern.
If you are looking to match filenames, you might want to have a look
at the fnmatch and glob modules. The patterns that
[EMAIL PROTECTED] wrote:
> actually, i am doing an application that allows user to delete files by
> entering an input pattern. so if he has files that have special
> characters such as [-] or others, then i want to filter them off
I think you will have to define what "pattern" means here.
Fredrik Lundh wrote:
> [EMAIL PROTECTED] wrote:
>
> > pat = re.compile(r"%s" %(userinput) ) #userinput is passed from
> > command line argument
>
> that r"%s" % (userinput) thing is a pointless operation: the "r" prefix
> controls how backslashes in a string literal is parsed; the result is an
[EMAIL PROTECTED] wrote:
> pat = re.compile(r"%s" %(userinput) ) #userinput is passed from
> command line argument
that r"%s" % (userinput) thing is a pointless operation: the "r" prefix
controls how backslashes in a string literal is parsed; the result is an
ordinary string ("%s" in this ca
[EMAIL PROTECTED] wrote:
> hi
>
> i created a script to ask user for an input that can be a pattern
> right now, i use re to compile that pattern
> pat = re.compile(r"%s" %(userinput) ) #userinput is passed from
> command line argument
> if the user key in a pattern , eg [-] , and my script will
[EMAIL PROTECTED] wrote:
> hi
>
> i created a script to ask user for an input that can be a pattern
> right now, i use re to compile that pattern
> pat = re.compile(r"%s" %(userinput) ) #userinput is passed from
> command line argument
> if the user key in a pattern , eg [-] , and my script will
hi
i created a script to ask user for an input that can be a pattern
right now, i use re to compile that pattern
pat = re.compile(r"%s" %(userinput) ) #userinput is passed from
command line argument
if the user key in a pattern , eg [-] , and my script will search some
lines that contains [-]
p