A question about a metacharacter

Chris cwitts at gmail.com
Thu Mar 20 12:38:04 CET 2008

On Mar 20, 1:19 pm, igbt <lun... at gmail.com> wrote:
> I am creating a simple script which is using gtk. In this script you
> must enter a text, if you do not enter anything or you enter a dot,
> the script will be finished. However, if you don't enter anything the
> script works but if you enter a dot (.) the script does not work. I
> was investigating about it and I think the problem is with the dot
> character  sss == "." .  I was trying the same line with other
> metacharacters like *, (, ) ...  and I found the same problem. I was
> looking for an example where I could see the way I could do it without
> any error but I did not find it. Could somebody tell me how can I
> solve this error?
> sss = entryName.get_text()      # The script gets the text
>         if sss == "" or sss == ".":
>                 gtk.main_quit()        #The script finishes
> Thanks ; -)

try this.

sss = entryName.get_text()
if not sss.strip() or sss.strip() == '.':

I wouldn't be suprised if your input is being captured with End-Of-
Line characters which would cause the mis-match.

More information about the Python-list mailing list