Re: [Tutor] Regular expression - I

2014-02-18 Thread Santosh Kumar
Thank you all. I got it. :) I need to read more between lines . On Wed, Feb 19, 2014 at 4:25 AM, spir wrote: > On 02/18/2014 08:39 PM, Zachary Ware wrote: > >> Hi Santosh, >> >> On Tue, Feb 18, 2014 at 9:52 AM, Santosh Kumar >> wrote: >> >>> >>> Hi All, >>> >>> If you notice the below example,

Re: [Tutor] Using for loops for combinations

2014-02-18 Thread Danny Yoo
On Tue, Feb 18, 2014 at 6:34 PM, Chinanu 'Chinex' Onyekachi wrote: > Thanks for taking you time to explain. > > minus = ['subtract'] #creates a list for subtract > > > for i in minus: > > minuslist1 = [i[0].upper() + i[1:]] > > minuslist2 = [i[0] + i[1].upper() + i[2:]] > > minuslist3 = [i[0:].upp

Re: [Tutor] Using for loops for combinations

2014-02-18 Thread Danny Yoo
On Tue, Feb 18, 2014 at 5:15 PM, Chinanu 'Chinex' Onyekachi wrote: > I’m having difficulties uppercasing a single portion (e.g. hAt) and two > portions (e.g. HaT) of the string. [Adding tutor@python.org to CC. Please use reply-to-all in future emails on this list. Thanks!] Hi Chinanu, Ther

Re: [Tutor] Regular expression - I

2014-02-18 Thread spir
On 02/18/2014 08:39 PM, Zachary Ware wrote: Hi Santosh, On Tue, Feb 18, 2014 at 9:52 AM, Santosh Kumar wrote: Hi All, If you notice the below example, case I is working as expected. Case I: In [41]: string = "test" In [42]: re.match('',string).group() Out[42]: '' But why is the raw string

Re: [Tutor] could please convert this code to 3.X by using 2to3

2014-02-18 Thread Danny Yoo
> > - Don't spam the same question in several different threads, and > especially don't privately email list participants with the same > question. Doing so is likely to get you ignored by people who would > otherwise be quite happy to help you. I'd like to make that comment stronger: by repeati

Re: [Tutor] could please convert this code to 3.X by using 2to3

2014-02-18 Thread Mark Lawrence
On 18/02/2014 20:57, S Tareq wrote: sorry, is there any other way to convert the coding Use an editor? Or try this:- c:\Users\Mark>2to3 --help Usage: 2to3 [options] file|dir ... Options: -h, --helpshow this help message and exit -d, --doctests_only Fix up doctests only -

Re: [Tutor] could please convert this code to 3.X by using 2to3

2014-02-18 Thread S Tareq
sorry, is there any other way to convert the coding On Tuesday, 18 February 2014, 20:41, Zachary Ware wrote: On Tue, Feb 18, 2014 at 12:18 PM, S Tareq wrote: > i am to convert coding to python 3.X. and some one told me to use 2to3 > program but  i don't how to use 2to3 program i was reading

Re: [Tutor] could please convert this code to 3.X by using 2to3

2014-02-18 Thread Zachary Ware
On Tue, Feb 18, 2014 at 12:18 PM, S Tareq wrote: > i am to convert coding to python 3.X. and some one told me to use 2to3 > program but i don't how to use 2to3 program i was reading and followed the > rules in python website ( > http://docs.python.org/3/library/2to3.html?highlight=2to3#module-lib

[Tutor] could please convert this code to 3.X by using 2to3

2014-02-18 Thread S Tareq
i am to convert coding to python 3.X. and some one told me to use 2to3 program but  i don't how to use 2to3 program i was reading and followed the rules in python website ( http://docs.python.org/3/library/2to3.html?highlight=2to3#module-lib2to3 ) but it says error and don't work. is there any

Re: [Tutor] Regular expression - I

2014-02-18 Thread Emile van Sebille
On 2/18/2014 11:42 AM, Mark Lawrence wrote: On 18/02/2014 18:03, Steve Willoughby wrote: Because the regular expression means “match an angle-bracket Please do not top post on this list. Appropriate trimming is also appreciated. Emile ___

Re: [Tutor] Using for loops for combinations

2014-02-18 Thread S Tareq
does any one know how to use 2to3 program to convert 2.7 python coding 3.X please i need help sorry  thank you  On Tuesday, 18 February 2014, 19:18, Danny Yoo wrote: On Tue, Feb 18, 2014 at 8:37 AM, Chinanu 'Chinex' Onyekachi wrote: > Find all possible combinations of a specific word (stri

Re: [Tutor] cx_freeze windows 7 python 3.3

2014-02-18 Thread S Tareq
does any one know how to use 2to3 program to convert 2.7 python coding 3.X please i need help sorry  thank you ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Regular expression - I

2014-02-18 Thread Albert-Jan Roskam
_ > From: Steve Willoughby >To: Santosh Kumar >Cc: python mail list >Sent: Tuesday, February 18, 2014 7:03 PM >Subject: Re: [Tutor] Regular expression - I > > >Because the regular expression means “match an angle-bracket character, >zero or more H characters, f

Re: [Tutor] Regular expression - I

2014-02-18 Thread S Tareq
does any one know how to use 2to3 program to convert 2.7 coding 3.X please i need help sorry  On Tuesday, 18 February 2014, 19:50, Zachary Ware wrote: On Tue, Feb 18, 2014 at 11:39 AM, Zachary Ware wrote: >    >>> '' >    '' > > The equivalent raw string is exactly the same in this case:

Re: [Tutor] Regular expression - I

2014-02-18 Thread Zachary Ware
On Tue, Feb 18, 2014 at 11:39 AM, Zachary Ware wrote: >>>> '' >'' > > The equivalent raw string is exactly the same in this case: > >>>> r'' >'' Oops, I mistyped both of these. The repr should be '' in both cases. Sorry for the confusion! -- Zach _

Re: [Tutor] Regular expression - I

2014-02-18 Thread Mark Lawrence
On 18/02/2014 18:03, Steve Willoughby wrote: Because the regular expression means “match an angle-bracket character, zero or more H characters, followed by a close angle-bracket character” and your string does not match that pattern. This is why it’s best to check that the match succeeded bef

Re: [Tutor] Regular expression - I

2014-02-18 Thread Zachary Ware
Hi Santosh, On Tue, Feb 18, 2014 at 9:52 AM, Santosh Kumar wrote: > > Hi All, > > If you notice the below example, case I is working as expected. > > Case I: > In [41]: string = "test" > > In [42]: re.match('',string).group() > Out[42]: '' > > But why is the raw string 'r' not working as expected

Re: [Tutor] cx_freeze windows 7 python 3.3

2014-02-18 Thread Danny Yoo
On Tue, Feb 18, 2014 at 3:59 AM, KEVIN ROBINSON wrote: > I am new to this site so please forgive me if I am forwarding this question > to the wrong person. > > I am trying to use cx_freeze on windows 7 with python 3.3. Unfortunately, this may not be the best mailing list to help with cx_freeze i

Re: [Tutor] Using for loops for combinations

2014-02-18 Thread Danny Yoo
On Tue, Feb 18, 2014 at 8:37 AM, Chinanu 'Chinex' Onyekachi wrote: > Find all possible combinations of a specific word (string) using any > combination of upper case and lower case letters with a for loop (no > itertools). > > > An example: > > string_input = hat > > comboination = ['hat', 'Hat',

Re: [Tutor] OCR Library

2014-02-18 Thread Danny Yoo
On Tue, Feb 18, 2014 at 7:16 AM, Khalid Al-Ghamdi wrote: > Hi, > > Do you have any recommendations regarding a good OCR library (preferably > Py3)? Unsure. This is somewhat of a specialized question, and probably not beginner material. You might want to check up with the general discussion mai

Re: [Tutor] Regular expression - I

2014-02-18 Thread Steve Willoughby
Because the regular expression means “match an angle-bracket character, zero or more H characters, followed by a close angle-bracket character” and your string does not match that pattern. This is why it’s best to check that the match succeeded before going ahead to call group() on the result

Re: [Tutor] Regular expression - I

2014-02-18 Thread Steve Willoughby
The problem is not the use of the raw string, but rather the regular expression inside it. In regular expressions, the * means that whatever appears before it may be repeated zero or more times. So if you say H* that means zero or more H’s in a row. I think you mean an H followed by any numbe

Re: [Tutor] Regular expression - I

2014-02-18 Thread Santosh Kumar
Steve, i am trying to under r - raw string notation. Am i understanding it wrong. Rather than using "\", it says we can use the "r" option. http://docs.python.org/2/library/re.html Check the first paragraph for the above link. Thanks, santosh On Tue, Feb 18, 2014 at 11:33 PM, Steve Willoughb

Re: [Tutor] constructing semi-arbitrary functions

2014-02-18 Thread Peter Otten
Oscar Benjamin wrote: > On 17 February 2014 20:13, Peter Otten <__pete...@web.de> wrote: >> André Walker-Loud wrote: >>> >>> The 3rd party minimizer utilizes the .func_code.co_varnames and >>> .func_code.co_argcount to determine the name and number of variables to >>> minimize. eg. >>> >>> =

[Tutor] Regular expression - I

2014-02-18 Thread Santosh Kumar
Hi All, If you notice the below example, case I is working as expected. Case I: In [41]: string = "test" In [42]: re.match('',string).group() Out[42]: '' But why is the raw string 'r' not working as expected ? Case II: In [43]: re.match(r'',string).group()

[Tutor] cx_freeze windows 7 python 3.3

2014-02-18 Thread KEVIN ROBINSON
I am new to this site so please forgive me if I am forwarding this question to the wrong person.   I am trying to use cx_freeze on windows 7 with python 3.3.   I can create a build folder and a dist folder using the command line without any problems.   When I click on the created .exe file I rece

[Tutor] OCR Library

2014-02-18 Thread Khalid Al-Ghamdi
Hi, Do you have any recommendations regarding a good OCR library (preferably Py3)? Thanks ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Using for loops for combinations

2014-02-18 Thread Chinanu 'Chinex' Onyekachi
Find all possible combinations of a specific word (string) using any combination of upper case and lower case letters with a for loop (no itertools). An example: string_input = hat comboination = ['hat', 'Hat', 'HAt', 'HAT', 'hAT', 'haT', 'HaT', 'hAt'] What I've tried so far, I’m trying

Re: [Tutor] constructing semi-arbitrary functions

2014-02-18 Thread Oscar Benjamin
On 18 February 2014 00:51, "André Walker-Loud " wrote: >> >> BTW if you're trying to fit the coefficients of a polynomial then a >> general purpose optimisation function is probably not what you want to >> use. I would probably solve (in a least squares sense and after >> suitable scaling) the Van

Re: [Tutor] for: how to skip items

2014-02-18 Thread Neil Cerutti
On 2014-02-17, Oscar Benjamin wrote: > On 17 February 2014 16:17, Gabriele Brambilla > wrote: >> Doesn't exist a way in Python to do like in C >> >> for i=0, i<100, i=i+10 >> >> ? without creating a list of index? > > You haven't said which Python version you're using. In Python 2 > the range func

Re: [Tutor] constructing semi-arbitrary functions

2014-02-18 Thread spir
On 02/17/2014 08:23 PM, "André Walker-Loud " wrote: Hello python tutors, I am utilizing a 3rd party numerical minimization routine. This routine requires an input function, which takes as arguments, only the variables with which to solve for. But I don’t want to define all possible input fun

Re: [Tutor] constructing semi-arbitrary functions

2014-02-18 Thread spir
On 02/18/2014 12:02 AM, Oscar Benjamin wrote: On 17 February 2014 22:15, "André Walker-Loud " wrote: This particular case is easily solved: def f_lambda(x,pars): return lambda x: poly(x,*pars) You let the closure take care of pars and return a function that takes exactly one argument x.