[Tutor] A Byte of Python or Learn python the hard way
I want to start learning python today and I wanted to know which book I should start with: A Byte of Python or Learn python the hard way? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] A Byte of Python or Learn python the hard way
keith papa writes: > I want to start learning python today Welcome. What is your current level of programming knowledge? What langauges, if any, do you already use? What are your goals for learning Python? What will you use it for? -- \ “Few things are harder to put up with than the annoyance of a | `\ good example.” —Mark Twain, _Pudd'n'head Wilson_ | _o__) | Ben Finney ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] A Byte of Python or Learn python the hard way
https://www.coursera.org/course/interactivepython?from_restricted_preview=1&course_id=971041&r=https%3A%2F%2Fclass.coursera.org%2Finteractivepython-003%2Fclass On 13 April 2014 18:29, Ben Finney wrote: > keith papa writes: > > > I want to start learning python today > > Welcome. > > What is your current level of programming knowledge? What langauges, if > any, do you already use? > > What are your goals for learning Python? What will you use it for? > > -- > \ "Few things are harder to put up with than the annoyance of a | > `\ good example." --Mark Twain, _Pudd'n'head Wilson_ | > _o__) | > Ben Finney > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > -- Luke Pettit ,,, ^..^,,, http://lukepettit-3d.blogspot.com/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] cdata/aml question..
bruce wrote: > The following text contains sample data. I'm simply trying to parse it > using libxml2dom as the lib to extract data. > > As an example, to get the name/desc > > test data > > > d = libxml2dom.parseString(s, html=1) > > p1="//department/name" > p2="//department/desc" > > pcount_ = d.xpath(p1) > p2_ = d.xpath(p2) > print str(len(pcount_)) > nba=0 > > for a in pcount_: > abbrv=a.nodeValue > print abbrv > abbrv=a.toString() > print abbrv > abbrv=a.textContent > print abbrv > > neither of the above generates any of the CML name/desc data.. > > any pointers on what I'm missing??? Your example seems to work here when I omit the html=1 d = libxml2dom.parseString(s) ... > I can/have created a quick parse/split process to get the data, but I > thought there'd be a straight forward process to extract the data > using one of the py/libs.. One way using the stdlib: from xml.etree import ElementTree as ET #root = ET.parse(filename).getroot() root = ET.fromstring(data) for department in root.findall(".//department"): name = department.find("name").text desc = department.find("desc").text print("{}: {}".format(name, desc)) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] cdata/aml question..
Peter Otten, 13.04.2014 10:56: > from xml.etree import ElementTree as ET > #root = ET.parse(filename).getroot() > root = ET.fromstring(data) > for department in root.findall(".//department"): > name = department.find("name").text > desc = department.find("desc").text name = department.findtext("name") desc = department.findtext("desc") > print("{}: {}".format(name, desc)) Stefan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor