[Tutor] Can someone help me start learning how to code?

2018-03-30 Thread Deniz Baydemir
I want to know where to start and if i can get assigned homework maybe? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Indexing values as a step in mesa model?

2018-03-30 Thread S L
Hi all, Very new to this so please excuse my errors. I want to create an agent based model using the mesa package (Python 3.6.3) to model solar generation, electricity use and grid exports. Ultimately I would like agents (households) to interact (ie trading energy between homes). For the first

Re: [Tutor] XML parsing

2018-03-30 Thread Asif Iqbal
On Thu, Mar 29, 2018 at 3:41 PM, Peter Otten <__pete...@web.de> wrote: > Asif Iqbal wrote: > > > On Thu, Mar 29, 2018 at 3:56 AM, Peter Otten <__pete...@web.de> wrote: > > > >> Asif Iqbal wrote: > >> > >> > I am trying to extract all the *template-name*s, but no success yet > >> > > >> > Here is a

Re: [Tutor] XML parsing

2018-03-30 Thread Asif Iqbal
On Thu, Mar 29, 2018 at 9:40 PM, Asif Iqbal wrote: > > > On Thu, Mar 29, 2018 at 3:41 PM, Peter Otten <__pete...@web.de> wrote: > >> Asif Iqbal wrote: >> >> > On Thu, Mar 29, 2018 at 3:56 AM, Peter Otten <__pete...@web.de> wrote: >> > >> >> Asif Iqbal wrote: >> >> >> >> > I am trying to extract a

Re: [Tutor] pythonic

2018-03-30 Thread Alan Gauld via Tutor
On 30/03/18 03:48, Pat Martin wrote: > the "right" way to do it in python? More or less, a couple of comments below... > def Main(): Python function names begin with a lowercase letter by convention. > """Run if run as a program.""" > parser = argparse.ArgumentParser() ... > > no

Re: [Tutor] XML parsing

2018-03-30 Thread Stefan Behnel
Asif Iqbal schrieb am 30.03.2018 um 03:40: > On Thu, Mar 29, 2018 at 3:41 PM, Peter Otten wrote: >> Asif Iqbal wrote: >>> On Thu, Mar 29, 2018 at 3:56 AM, Peter Otten wrote: Asif Iqbal wrote: > Here is a sample xml file > > http://tail-f.com/ns/rest";> > http://networks.com/n

Re: [Tutor] pythonic

2018-03-30 Thread Peter Otten
Pat Martin wrote: > I have written the following program. It generates a template for Pelican > web site static generator. It works just fine, it generates the template > and then I put the info in it to customize. But I was wondering, is this > the "right" way to do it in python? You may rewrite

Re: [Tutor] Indexing values as a step in mesa model?

2018-03-30 Thread Steven D'Aprano
On Fri, Mar 30, 2018 at 02:06:15PM +1100, S L wrote: > Hi all, > > Very new to this so please excuse my errors. > > I want to create an agent based model using the mesa package (Python 3.6.3) Unfortunately, when you start asking questions about third-party libraries, especially fairly niche te

Re: [Tutor] pythonic

2018-03-30 Thread George Fischhof
2018-03-30 4:48 GMT+02:00 Pat Martin : > Hello all, > > I have written the following program. It generates a template for Pelican > web site static generator. It works just fine, it generates the template > and then I put the info in it to customize. But I was wondering, is this > the "right" way

Re: [Tutor] XML parsing

2018-03-30 Thread Neil Cerutti
On 2018-03-30, Stefan Behnel wrote: > I admit that I'm being a bit strict here, there are certainly > cases where parsing the namespace from a tag is a sensible > thing to do. I'm really just saying that most of the time, when > you feel the need to do that, it's worth reconsidering (or > asking)

Re: [Tutor] pythonic

2018-03-30 Thread Pat Martin
Thank you all for the ideas and comments, it is appreciated. I have some refactoring to do now. On Fri, Mar 30, 2018 at 2:22 AM, Peter Otten <__pete...@web.de> wrote: > Pat Martin wrote: > > > I have written the following program. It generates a template for Pelican > > web site static generator

Re: [Tutor] XML parsing

2018-03-30 Thread Stefan Behnel
Neil Cerutti schrieb am 30.03.2018 um 15:50: > On 2018-03-30, Stefan Behnel wrote: >> I admit that I'm being a bit strict here, there are certainly >> cases where parsing the namespace from a tag is a sensible >> thing to do. I'm really just saying that most of the time, when >> you feel the need t

[Tutor] really basic py/regex

2018-03-30 Thread bruce
Hi. Trying to quickly get the re.match() to extract the groups from the string. x="MATH 59900/40 [47490] - THE " The regex has to return MATH, 59900, 40,, and 47490 d=re.match(r'(\D+)...) gets the MATH... But I can't see (yet) how to get the rest of what I need... Pointers would be usefu

Re: [Tutor] XML parsing

2018-03-30 Thread Neil Cerutti
On 2018-03-30, Stefan Behnel wrote: > Neil Cerutti schrieb am 30.03.2018 um 15:50: >> On 2018-03-30, Stefan Behnel wrote: >>> I admit that I'm being a bit strict here, there are certainly >>> cases where parsing the namespace from a tag is a sensible >>> thing to do. I'm really just saying that mo

[Tutor] creating a connection class

2018-03-30 Thread Glenn Schultz
All, I can create a connection as follows and it works but I think it is best to have a connection class that opens and closes.  I create the connection class as outline below.  However, it does not work - meaning that it does not return a connection rather it returns  <__main__.modelingdb at

Re: [Tutor] creating a connection class

2018-03-30 Thread Alan Gauld via Tutor
On 30/03/18 15:55, Glenn Schultz wrote: > I can create a connection as follows and it works Well done, so you get a connection object back as a result. > but I think it is best to have a connection class that opens and closes.   Why? You already have a connection object. Classes are created so

Re: [Tutor] creating a connection class

2018-03-30 Thread Steven D'Aprano
On Fri, Mar 30, 2018 at 02:55:14PM +, Glenn Schultz wrote: > All, > > I can create a connection as follows and it works but I think it is best to > have a connection class that opens and closes. You already have one: that's what pyodbc.connect is. The documentation is pretty poor: https://