Thank you for those solutions so varied. Am going to have a party with them
to see what works best for me.
Strange is there a way too use lousy comprehension without returning just
the matching odd values?
Sayth
On Mon, 5 Jan 2015 5:06 AM Dan Stromberg wrote:
> I'm partial to:
>
> #!/usr/local
Hi
How can I actually access the values of an element with lxml objectify?
for example if I had this element in my xml file.
I can see all the attributes using this.
In [86]: for child in root.getchildren():
print(child.attrib)
:
{}
{'RequestCode': '', 'RequestId': '0'}
{}
{}
Awesome, thanks so much for the help.
Sayth
--
https://mail.python.org/mailman/listinfo/python-list
I am saying 'do it myself' in that with flask that provide a small base and
then all functionality is added by me directly, with the assistance of
community modules. Compared to Django whose developers have created an
integrated set of defaults with more functionality standard, which is good
if yo
HI
Probably very easy question.
If I have a section of html.
App
Approaching
D/N
Did nothing
DGO
Didn't go on
DRO
Didn't run on
H/In
Hung in
H/Out
Hung out
I can easily get the class values out.
In [69]: soup.find_all("td", class_="abbreviation")
Out[69]:
[App,
D/N,
DGO,
DRO,
H/In,
H/Ou
On Friday, 20 March 2015 15:20:41 UTC+11, Sayth Renshaw wrote:
> HI
>
> Probably very easy question.
>
> If I have a section of html.
>
>
> App
> Approaching
> D/N
> Did nothing
> DGO
> Didn't go on
> DRO
> Didn't run on
> H/In
>
Hi
Just checking if the reaction to cry when given XML is normal.
I thought maybe I am approaching it all wrong, using lxml largely or some
xquery to club it into submission.
See the usual goal is just to take the entire XML and push it into a database.
or in future experiment with Mongo or
Adam I am glad to hear it in someways because it's something I have never heard
it. For a person relatively new to XML most articles and tutorials demonstrate
getting it out to a more "manageable" format.
I had been using xbase to inspect the data and query but really ask I want to
do was push
why can't I filter a list based on an itertools condition using dropwhile?
This is the docs and the example.
https://docs.python.org/3/library/itertools.html#itertools.dropwhile
def less_than_10(x):
return x < 10
itertools.takewhile(less_than_10, itertools.count()) =>
0, 1, 2, 3, 4, 5, 6,
Thank You for the explanations.
I found this counter implementation is really cool and easily adaptable to more
solutions.
Thanks
> Alternatively collections.Counter() supports an arbitrary number of bins...
>
> >>> import collections
> >>> freq = collections.Counter(t[1] for t in stats)
> >>>
Is there a way to specify to all attributes in xpath? Instead of directly Eg
//element/@attr
So that you could effectively loop and filter if an element had more than one
Attribute?
So items = tree.xpath(@all_attrs)
>From lxml import etree
Tree = etree.Xpath(//root)
For k, v in items:
C
On Friday, 29 May 2015 09:21:01 UTC+10, Sayth Renshaw wrote:
> Is there a way to specify to all attributes in xpath? Instead of directly Eg
> //element/@attr
>
> So that you could effectively loop and filter if an element had more than one
> Attribute?
>
> So items =
In future releases of Python should ipython Notebooks replace idle as the
default tool for new users to learn python?
This would as I see it have many benefits?
1. A nicer more usual web interface for new users.
2. Would allow the python documentation and tutorials to be distributed as
ipython
On Sunday, 5 July 2015 05:16:04 UTC+10, Sturla Molden wrote:
> Jason Swails wrote:
>
> > Everything gets swallowed into Python. I can't imagine this ever happening.
>
> IPython's successor Jupyter is also an REPL environment for Julia and R,
> and many other languages will also be supported (e
I was playing with odo(blaze http://blaze.pydata.org/en/latest/) and wanted to
use it with a current script I have been using on the command line.
So my 2 scripts are below, I will explain here hopefully to keep question
clearer what I have done. Script 2 works for me from the command line as
p
On Sunday, 5 July 2015 10:23:17 UTC+10, Sayth Renshaw wrote:
> I was playing with odo(blaze http://blaze.pydata.org/en/latest/) and wanted
> to use it with a current script I have been using on the command line.
>
> So my 2 scripts are below, I will explain here hopefully to k
Just wondering if there is an archive mirror for these binaries available. i
was looking for lxml 3.4.1 and the current version is the latest on the page at
3.4.4 being on windows I cannot build it.
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Thanks
Sayth
--
https://mail.python.org/mailman/lis
On Sunday, 8 November 2015 20:44:02 UTC+11, Chris Warrick wrote:
> On 8 November 2015 at 06:55, Sayth Renshaw wrote:
> > Just wondering if there is an archive mirror for these binaries available.
> > i was looking for lxml 3.4.1 and the current version is the latest on the
&g
On Sunday, 8 November 2015 21:30:59 UTC+11, Laura Creighton wrote:
> In a message of Sat, 07 Nov 2015 21:55:32 -0800, Sayth Renshaw writes:
> >Just wondering if there is an archive mirror for these binaries available. i
> >was looking for lxml 3.4.1 and the current version is th
Hi
I was wondering if there is a reason that we on windows with python do not have
a version of Ruby devkit for python.
Is it just for historical reason of life before pip became the package manager
and released with python?
I can't find the actual post in SO it came off this discussion
http
This is an exert
DevKit Overview
The DevKit is a toolkit that makes it easy to build and use native C/C++
extensions such as RDiscount and RedCloth for Ruby on Windows.
Because on Windows with python libraries like lxml will fail with a vcvarsall
error based on different c++ compilers.
Sayth
How can I flatten just a specific sublist of each list in a list of lists?
So if I had this data
[ ['46295', 'Montauk', '3', '60', '85', ['19', '5', '1', '0 $277790.00']],
['46295', 'Dark Eyes', '5', '59', '83', ['6', '4', '1', '0 $105625.00']],
['46295', 'Machinegun Jubs', '6', '53',
> Replace the slice row[index:index+1] with row[index], either by building a
> new list or in place:
>
> >>> def show(data):
> ...for item in data: print(item)
> ...
> >>> def flatten_one(rows, index):
> ... return [r[:index] + r[index] + r[index+1:] for r in rows]
> ...
> >>> def fla
Hi
I have got this dictionary comprehension and it works but how can I do it
better?
from collections import Counter
def find_it(seq):
counts = dict(Counter(seq))
a = [(k, v) for k,v in counts.items() if v % 3 == 0]
return a[0][0]
test_seq = [20,1,-1,2,-2,3,3,5,5,1,2,4,20,4,-1,-
> > But the given problem states there will always only be one number appearing
> > an odd number of times given that is there a neater way to get the answer?
>
> Take a step back for a moment. Are you trying to find something that
> appears an odd number of times, or a number of times that coun
Peter I really like this
The complete code:
>>> from collections import Counter
>>> def find_it(seq):
... [result] = [k for k, v in Counter(seq).items() if v % 3 == 0]
... return result
...
>>> test_seq = [20,1,-1,2,-2,3,3,5,5,1,2,4,20,4,-1,-2,5]
>>> find_it(test_seq)
But what ma
Afternoon
Is there an obvious method I am missing in creating a list of dates? I want to
get a list of each Saturday and each Wednesday for the year 2017.
It seems and maybe this is where I am wrong but doesn't the datetime library
already know the dates if yes is there an easy way to query it?
> > Is there an obvious method I am missing in creating a list of dates? I want
> > to get a list of each Saturday and each Wednesday for the year 2017.
> >
> > It seems and maybe this is where I am wrong but doesn't the datetime
> > library already know the dates if yes is there an easy way to
> > Thoughts or examples?
> >
> dateutil.rrule is what you may use e.g.
>
>
> In [38]: from dateutil import rrule
>
> In [39]: from datetime import date
Hi
I am struggling to figure out how I can create a generator to provide values to
my url. My url needs to insert the year month and day in the url not as params
to the url.
import json
import requests
import datetime
# using this I can create a list of dates for the first 210 days of this ye
Thanks.
I left "base" out as i was trying to remove as much uneeded code from example
as possible. I had defined it as
base = datetime.datetime(2017,1,1)
Reading your code this sounds to simple :-).
def dates(first, numdays):
# generate datetime objects for extra clarity
# note ther
I was trying to solve a problem and cannot determine how to filter 0's but not
false.
Given a list like this
["a",0,0,"b",None,"c","d",0,1,False,0,1,0,3,[],0,1,9,0,0,{},0,0,9]
I want to be able to return this list
["a","b",None,"c","d",1,False,1,3,[],1,9,{},9,0,0,0,0,0,0,0,0,0,0]
However if I f
On Friday, 7 July 2017 12:46:51 UTC+10, Rick Johnson wrote:
> On Thursday, July 6, 2017 at 9:29:29 PM UTC-5, Sayth Renshaw wrote:
> > I was trying to solve a problem and cannot determine how to filter 0's but
> > not false.
> >
> > Given a list like this
> &g
> Another option is to test for type(value) == int:
>
> >>> before = ["a",0,0,"b",None,"c","d",0,1,False,0,1,0,3,[],0,1,9,0,0,
> {},0,0,9]
> >>> wanted = ["a","b",None,"c","d",1,False,1,3,[],1,9,
> {},9,0,0,0,0,0,0,0,0,0,0]
> >>> after = sorted(before, key=lambda x: x == 0 and type(x) == int)
> >
Morning
I haven't ventured into classes much before. When trying to follow some
examples and create my own classes in a jupyter notebook I receive an error
that the class is undefined.
So I created for practise a frog class
class frog(object):
def __init__(self, ftype, word):
On Thursday, 17 August 2017 09:03:59 UTC+10, Ian wrote:
wrote:
> > Morning
> >
> > I haven't ventured into classes much before. When trying to follow some
> > examples and create my own classes in a jupyter notebook I receive an error
> > that the class is undefined.
> >
> > So I created for pr
201 - 236 of 236 matches
Mail list logo