473,756 Members | 5,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A question about a metacharacter

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_t ext() # The script gets the text
if sss == "" or sss == ".":
gtk.main_quit() #The script finishes
Thanks ; -)
Mar 20 '08 #1
3 1305
On Mar 20, 1:19*pm, igbt <lun...@gmail.c omwrote:
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_t ext() * * *# The script gets the text
* * * * if sss == "" or sss == ".":
* * * * * * * * gtk.main_quit() * * * *#The scriptfinishes

Thanks ; -)
try this.

sss = entryName.get_t ext()
if not sss.strip() or sss.strip() == '.':
gtk.main_quit()

I wouldn't be suprised if your input is being captured with End-Of-
Line characters which would cause the mis-match.
Mar 20 '08 #2
On 20 mar, 12:38, Chris <cwi...@gmail.c omwrote:
On Mar 20, 1:19 pm, igbt <lun...@gmail.c omwrote:
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_t ext() # The script gets the text
if sss == "" or sss == ".":
gtk.main_quit() #The script finishes
Thanks ; -)

try this.

sss = entryName.get_t ext()
if not sss.strip() or sss.strip() == '.':
gtk.main_quit()

I wouldn't be suprised if your input is being captured with End-Of-
Line characters which would cause the mis-match.
It does not work. Thanks for your help
Mar 20 '08 #3
On Mar 20, 8:19*am, igbt <lun...@gmail.c omwrote:
However, if you don't enter anything the
script works but if you enter a dot (.) the script does not work.
Have you tried it with other non-metacharacter values?
sss = entryName.get_t ext() * * *# The script gets the text
* * * * if sss == "" or sss == ".":
* * * * * * * * gtk.main_quit() * * * *#The scriptfinishes
Try adding this:
else:
print sss, type(sss)

Good luck!
Daniel
Mar 20 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2843
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew story is so funny that eScrew will have to take break from time to time because eScrew needs some rest from laughing. Oh boy, here it comes... eScrew funny laugh laughing screaming crying must stop can not take any more this is killing eScrew...
220
19128
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it seems that Ruby has the potential to compete with and displace Python. I'm curious on what basis it...
8
2461
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew story is so funny that eScrew will have to take break from time to time because eScrew needs some rest from laughing. Oh boy, here it comes... eScrew funny laugh laughing screaming crying must stop can not take any more this is killing eScrew...
125
14823
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
5
2999
by: eScrewDotCom | last post by:
www.eScrew.com eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew story is so funny that eScrew will have to take break from time to time because eScrew needs some rest from laughing. Oh boy, here it comes... eScrew funny laugh laughing
0
2455
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew story is so funny that eScrew will have to take break from time to time because eScrew needs some rest from laughing. Oh boy, here it comes... eScrew funny laugh laughing screaming crying must stop can not take any more this is killing eScrew...
7
3154
by: Edward Yang | last post by:
A few days ago I started a thread "I think C# is forcing us to write more (redundant) code" and got many replies (more than what I had expected). But after reading all the replies I think my question about local variable initialization is still not solved. And some of the replies forked into talking about out parameters. And the thread is becoming way too deep. So I open a new thread here. My question in the previous thead has turned...
1
1006
by: Peng Yu | last post by:
Hi, '\b' only match the boundary between alphanumerical char and nonalphanumerical char. I'm wonder if there is a generic metacharacter to match the boundary between any non intersected char set defined in regex and its complement. For example, I have a few non intersected char sets , and , and lets call the new metacharactor \m.
0
9454
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9271
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9868
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8709
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6533
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3352
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2664
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.