Re: [Tutor] regular expression question

2009-04-28 Thread Kelie
spir free.fr> writes: > To avoid that, use non-grouping parens (?:...). This also avoids the need for parens around the whole format: > p = Pattern(r'abc(?:(?!abc).)+jk') > print p.findall(s) > ['abc789jk'] > > Denis This one works! Thank you Denis. I'll try it out on the actual much longer (m

Re: [Tutor] regular expression question

2009-04-28 Thread Kelie
Andre Engels gmail.com> writes: > > 2009/4/28 Marek SpociƄski go2.pl,Poland 10g.pl>: > > I suggest using r'abc.+?jk' instead. > > > > That was my first idea too, but it does not work for this case, > because Python will still try to _start_ the match as soon as > possible. yeah, i tried t

[Tutor] regular expression question

2009-04-28 Thread Kelie
Hello, The following code returns 'abc123abc45abc789jk'. How do I revise the pattern so that the return value will be 'abc789jk'? In other words, I want to find the pattern 'abc' that is closest to 'jk'. Here the string '123', '45' and '789' are just examples. They are actually quite different in

Re: [Tutor] How to create array of variants?

2008-07-09 Thread Kelie
Monika Jisswel googlemail.com> writes: > > > Comment : I never did any VB so I am not sure if I understand you.supposing your data comes like this :python code : > > > Data = ( ('A', 1), ('B', 2), ('C', 3), ('D', 4) )#you can create a list of the items like this : List_Letters = [ x[0] for x

Re: [Tutor] How to create array of variants?

2008-07-08 Thread Kelie
Alan Gauld btinternet.com> writes: > So if you pass in two Python lists containing: > > DataType = [1001,1070] > Data = ["Test_Application", 600] > > Does it work? > > If not what error do you get? (The full text please) > Thanks Alan. This is the error I got: Traceback (most recent call las

Re: [Tutor] How to create array of variants?

2008-07-08 Thread Kelie
Andre Engels gmail.com> writes: > > So what does the code of line.SetXData(dataType, dataValue) look like? > >From that code you should be able to discern what argument type is > wanted. > Thanks Andre. I don't know how the correct code should look like in Python. In VB, I've posted the code in

Re: [Tutor] How to create array of variants?

2008-07-08 Thread Kelie
John, Thanks for your reply. I'm aware of list, tuple, sets, etc. and have tried them, which results in an error: Invalid argument type in SetXData method. My understanding is that I do need an array here. Just don't know the correct way of doing it. __

[Tutor] How to create array of variants?

2008-07-07 Thread Kelie
Hello group, I'm trying to translate the following VB code into Python and not sure how to create an array of variants. Thanks for your help! VB Code: Sub SetXdata() Dim lineObj As AcadLine Set lineObj = ThisDrawing.ModelSpace.Item(0) Dim DataType(0 To 1) As Integer Dim Dat

Re: [Tutor] Where is this tr function?

2008-07-04 Thread Kelie
Alan Gauld btinternet.com> writes: > To the OP: > Are you importing any other modules? Is this a specific application's > code you are looking at? > Thanks Alan. You're right. I was reading Ulipad's source code. ___ Tutor maillist - Tutor@python.or

Re: [Tutor] Where is this tr function?

2008-07-04 Thread Kelie
Kent Johnson tds.net> writes: > You have to find where tr() is being imported. From PyShell type > tr.__module__ > that should print the name of the module containing tr(). > Thanks Kent. Actually it isn't PyShell. It is in Ulipad's (Ulipad is a freeware code editor) Python shell. I followed you

[Tutor] Where is this tr function?

2008-07-04 Thread Kelie
Hello, I see a lots tr('some string') in codes, especially the ones related to wxPython. Where is this tr function defined and what does it do? To make the argument a raw string? When I type print tr('some string') in PyShell that comes with wxPython, no error. But if I type that line in a .py fi

Re: [Tutor] Is "var = None" in Python equivalent to "Set var = Nothing"in VB?

2008-06-30 Thread Kelie
wesley chun gmail.com> writes: > one question i'd like to ask is, in what context is such a line part > of your code? altho alan is correct in that syntactically, they're > very similar, i'm wondering what you're using it for. Wesley, Thanks for your reply (also thanks to others who replied). I

Re: [Tutor] Is "var = None" in Python equivalent to "Set var = Nothing"in VB?

2008-06-29 Thread Kelie
Thanks Alan. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] need help with a regular expression

2008-06-28 Thread Kelie
Mark Tolonen gmail.com> writes: > re.compile(r'^_{0,3}[A-Z](?:[A-Z0-9]|-(?!-))*[A-Z0-9]$') # if rule 4 is an > additional letter or digit > re.compile(r'^_{0,3}[A-Z](?:[A-Z0-9]|-(?!-))*(? single-letter strings are allowed > Mark, single-letter strings are allowed and your regular expression w

Re: [Tutor] need help with a regular expression

2008-06-28 Thread Kelie
Dick Moores gmail.com> writes: > I'm not sure of your 5th condition. Do you mean, "A hyphen should not > be immediately followed by a hyphen"? Could you give examples of what > you will permit, and will not permit? Dick, your are correct. A hyphen should not be immediately followed by a hyphen.

[Tutor] need help with a regular expression

2008-06-28 Thread Kelie
Hello, I'm trying to write a regular expression to filter strings that meet the following criteria: 1. Starts with 0-3 underscores; 2. Followed by one letter; 3. Then followed by 0 or more letters or digits or hyphens('-'), 4. Ends with one letter or digit; and 5. There should not be more than o

[Tutor] Is "var = None" in Python equivalent to "Set var = Nothing" in VB?

2008-06-28 Thread Kelie
Hello, Suppose var holds a reference to an objeect, my question is in the subject. Thanks! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor