import lxml.html
myxml='''
'''
root=lxml.html.fromstring(myxml)
nodes1=root.xpath('//job[@DecreaseHour="1"]')
nodes2=root.xpath('//job[@table="tpa_radio_sum"]')
print "nodes1=",nodes1
print "nodes2=",nodes2
>>>
nodes1= []
nodes2= [, , ]
would you mind to tell me why nodes1=[]??
--
h
import lxml.html
myxml='''
'''
root=lxml.html.fromstring(myxml)
nodes1=root.xpath('//job[@DecreaseHour="1"]')
nodes2=root.xpath('//job[@ne_type="101"]')
print "nodes1=",nodes1
print "nodes2=",nodes2
Thank you. I tried __rtruediv__ and it works.
On Jan 23, 2012, at 12:14 AM, Ian Kelly wrote:
> On Sun, Jan 22, 2012 at 10:22 PM, Massimo Di Pierro
> wrote:
> Hello everybody,
>
> I hope somebody could help me with this problem. If this is not the right
> place to ask, please direct me to the
On Sun, Jan 22, 2012 at 10:22 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:
> Hello everybody,
>
> I hope somebody could help me with this problem. If this is not the right
> place to ask, please direct me to the right place and apologies.
> I am using Python 2.7 and I am writing some
Hello everybody,
I hope somebody could help me with this problem. If this is not the right place
to ask, please direct me to the right place and apologies.
I am using Python 2.7 and I am writing some code I want to work on 3.x as well.
The problem can be reproduced with this code:
# from __futu
On Jan 23, 2:05 am, Dan Sommers wrote:
> As per a now-ancient suggestion on this mailing list (I believe it was by
> Tim Peters), I've also been known to use a non-empty, literal Python
> string as a self-documenting, forever-True value in the typical loop-and-a-
> half cnstruct:
>
> while "th
On Jan 22, 6:47 pm, Michael Torrie wrote:
> I once argued to limit Python identifiers to latin letters only, but at
> least that made some sort of sense (lowest-common denominator) and it
> had nothing to do with running in an internationalized environment or
> dealing with unicode or utf-8 -encod
On 01/22/2012 06:04 PM, Rick Johnson wrote:
> That's just the point. If an expert such as myself can make a simple
> mistake as this, then one can only expect that the neophytes are going
> to suffer greatly. I wonder how many tutorials are out there in WWW
> still teaching old ways of writing Pyth
On Jan 22, 6:38 pm, Michael Torrie wrote:
> On 01/22/2012 08:50 AM, Rick Johnson wrote:
>
>
>
> > What does Python do when presented with this code?
>
> > py> [line.strip('\n') for line in f.readlines()]
>
> > If Python reads all the file lines first and THEN iterates AGAIN to do
> > the strip; we
Jacob Hallén sotospeak.se> writes:
>
> I have a problem which ought to have an obvious solution, but I haven't found
> one despite searching for many hours. The problem occurs on Windows.
You may be running into the brokenness of the Python import system prior to 3.2.
See http://bugs.python.or
On 01/22/2012 01:52 PM, Rick Johnson wrote:
> On Jan 22, 2:08 pm, Jacob Hallén wrote:
>
>> If I store these two files in say C:\Users\Admin\test everything works fine.
>>
>> If I store them in C:\Users\Admin\testф, I get an import error when running
>> foo.py. The letter at the end of test is a
Hi all.
Usually I work on Linux and all my cmake-built Python extensions working there
without trouble. Now these things need to work on Windows as well. While the
code itself compiles fine, linking and loading makes trouble.
First of, to successfully link everything with mingw (g++-4.4.0, som
On 01/22/2012 08:50 AM, Rick Johnson wrote:
>
> What does Python do when presented with this code?
>
> py> [line.strip('\n') for line in f.readlines()]
>
> If Python reads all the file lines first and THEN iterates AGAIN to do
> the strip; we are driving a Fred flintstone mobile. If however Pyth
Sunday 22 January 2012 you wrote:
> On Sun, Jan 22, 2012 at 12:08 PM, Jacob Hallén
>
> wrote:
> > I have a problem which ought to have an obvious solution, but I haven't
> > found one despite searching for many hours. The problem occurs on
> > Windows.
> >
> > This is a version of my problem red
On 22 January 2012 20:57, Michael Poeltl wrote:
> > Two iterations. And since that is the only possible way to do this, you
> > are correct, the language is terribly archaic. I suggest you switch to
> > Ruby ASAP.
> why there is only one possibility to do so? in a second i found this
> ''.join(o
Sunday 22 January 2012 you wrote:
> On Sun, Jan 22, 2012 at 12:08 PM, Jacob Hallén
>
> wrote:
> > I have a problem which ought to have an obvious solution, but I haven't
> > found one despite searching for many hours. The problem occurs on
> > Windows.
> >
> > This is a version of my problem red
* Ian Kelly [2012-01-22 19:29]:
> On Sun, Jan 22, 2012 at 8:50 AM, Rick Johnson
> wrote:
>
> >
> > What does Python do when presented with this code?
> >
> > py> [line.strip('\n') for line in f.readlines()]
> >
> > If Python reads all the file lines first and THEN iterates AGAIN to do
> > the str
On 22/01/2012 19:58, Arnaud Delobelle wrote:
On 22 January 2012 16:09, MRAB wrote:
On 22/01/2012 15:39, Arnaud Delobelle wrote:
[...]
Or more succintly (but not tested):
sections = [
("3", "section_1")
("5", "section_2")
("\xFF", "section_3")
]
with open(input_path)
On Jan 22, 2:08 pm, Jacob Hallén wrote:
> If I store these two files in say C:\Users\Admin\test everything works fine.
>
> If I store them in C:\Users\Admin\testф, I get an import error when running
> foo.py. The letter at the end of test is a Russian "F", if it looks strange on
> your terminal.
The grep solution is not cross-platform, and not really an answer to a
question about python.
The by-line iteration examples are inefficient and bad practice from a
numpy/vectorization perspective.
I would advice to do it the numpythonic way (untested code):
breakpoints = [3, 5, 7]
data = np.loa
On 1/22/2012 2:08 PM, Jacob Hallén wrote:
> Am using WIndows 7 with a Swedish locale. The program uses Unicode
> successfully internally, and the Windows help says that the locale only
> applies to non-Unicode programs. I have tried with using characters from the
> Latin-1 character set in the p
On Sun, Jan 22, 2012 at 12:08 PM, Jacob Hallén
wrote:
> I have a problem which ought to have an obvious solution, but I haven't found
> one despite searching for many hours. The problem occurs on Windows.
>
> This is a version of my problem reduced to its essentials:
>
> I have a file foo.py::
>
>
On Jan 22, 9:37 pm, Roy Smith wrote:
> On Jan 22, 2012, at 2:34 PM, Tim Chase wrote:
>
> > On 01/22/12 13:26, Roy Smith wrote:
> >>> If you wanted to do it in one pass using standard unix
> >>> tools, you can use:
>
> >>> sed -n -e'/^[0-2]/w first-three.txt' -e'/^[34]/w
> >>> next-two.txt' -e'/^[5
I have a problem which ought to have an obvious solution, but I haven't found
one despite searching for many hours. The problem occurs on Windows.
This is a version of my problem reduced to its essentials:
I have a file foo.py::
import bar
and a file bar.py :
baz = 42
If I store these two fi
On 22 January 2012 16:09, MRAB wrote:
> On 22/01/2012 15:39, Arnaud Delobelle wrote:
[...]
>> Or more succintly (but not tested):
>>
>>
>> sections = [
>> ("3", "section_1")
>> ("5", "section_2")
>> ("\xFF", "section_3")
>> ]
>>
>> with open(input_path) as input_file:
>> lines = it
On Jan 22, 2012, at 2:34 PM, Tim Chase wrote:
> On 01/22/12 13:26, Roy Smith wrote:
>>> If you wanted to do it in one pass using standard unix
>>> tools, you can use:
>>>
>>> sed -n -e'/^[0-2]/w first-three.txt' -e'/^[34]/w
>>> next-two.txt' -e'/^[5-7]/w next-three.txt'
>>>
>> I stand humbled.
>
On 01/22/12 13:26, Roy Smith wrote:
If you wanted to do it in one pass using standard unix
tools, you can use:
sed -n -e'/^[0-2]/w first-three.txt' -e'/^[34]/w
next-two.txt' -e'/^[5-7]/w next-three.txt'
I stand humbled.
In all likelyhood, you stand *younger*, not so much humbled ;-)
-tkc
I stand humbled.
On Jan 22, 2012, at 2:25 PM, Tim Chase wrote:
> On 01/22/12 08:45, Roy Smith wrote:
>> I would do this with standard unix tools:
>>
>> grep '^[012]' input.txt> first-three-seconds.txt
>> grep '^[34]' input.txt> next-two-seconds.txt
>> grep '^[567]' input.txt> next-three-secon
On 01/22/12 08:45, Roy Smith wrote:
I would do this with standard unix tools:
grep '^[012]' input.txt> first-three-seconds.txt
grep '^[34]' input.txt> next-two-seconds.txt
grep '^[567]' input.txt> next-three-seconds.txt
Sure, it makes three passes over the data, but for 20 MB of data, you
co
On Sun, Jan 22, 2012 at 8:50 AM, Rick Johnson
wrote:
>
> What does Python do when presented with this code?
>
> py> [line.strip('\n') for line in f.readlines()]
>
> If Python reads all the file lines first and THEN iterates AGAIN to do
> the strip; we are driving a Fred flintstone mobile. If howev
On 1/22/12 3:50 PM, Rick Johnson wrote:
What does Python do when presented with this code?
py> [line.strip('\n') for line in f.readlines()]
If Python reads all the file lines first and THEN iterates AGAIN to do
the strip; we are driving a Fred flintstone mobile. If however Python
strips each
Am 22.01.2012 16:50, schrieb Rick Johnson:
What does Python do when presented with this code?
py> [line.strip('\n') for line in f.readlines()]
If Python reads all the file lines first and THEN iterates AGAIN to do
the strip; we are driving a Fred flintstone mobile. If however Python
strips eac
On Jan 22, 6:56 pm, MRAB wrote:
> On 22/01/2012 16:17, Yigit Turgut wrote:
> [snip]
>
>
>
>
>
>
>
> > On Jan 22, 5:39 pm, Arnaud Delobelle wrote:
> [snip]
> >> Or more succintly (but not tested):
>
> >> sections = [
> >> ("3", "section_1")
> >> ("5", "section_2")
> >> ("\xFF", "s
import subprocess
com = ['/bin/ls', '-l', '/usr/bin']
with subprocess.Popen(com, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
as proc:
for line in proc.stdout:
print('out: ' + str(line, 'utf8'))
--
Yves. http://www.SollerS.ca/
On 22/01/2012 16:17, Yigit Turgut wrote:
[snip]
On Jan 22, 5:39 pm, Arnaud Delobelle wrote:
[snip]
Or more succintly (but not tested):
sections = [
("3", "section_1")
("5", "section_2")
("\xFF", "section_3")
]
with open(input_path) as input_file:
lines = iter(input_fi
What does Python do when presented with this code?
py> [line.strip('\n') for line in f.readlines()]
If Python reads all the file lines first and THEN iterates AGAIN to do
the strip; we are driving a Fred flintstone mobile. If however Python
strips each line of the lines passed into readlines in
On 2012-01-22 00:27, Chris Rebert wrote:
On Sat, Jan 21, 2012 at 9:45 PM, wrote:
Is this the expected behavior?
Yes. `.read()` [with no argument] on a file-like object reads until
EOF. See http://docs.python.org/library/stdtypes.html#file.read
Right, got it now.
You want proc.stdout.readl
On Jan 22, 4:45 pm, Roy Smith wrote:
> In article
> ,
> Yigit Turgut wrote:
> > Hi all,
>
> > I have a text file approximately 20mb in size and contains about one
> > million lines. I was doing some processing on the data but then the
> > data rate increased and it takes very long time to proce
On 22/01/2012 16:05, Dan Sommers wrote:
On Sun, 22 Jan 2012 05:25:25 +, Steven D'Aprano wrote:
Or they've been writing Python code since before version 2.2 when True
and False were introduced, and so they are used to the "while 1" idiom
and never lost the habit.
That would be me.
As p
On 22/01/2012 15:39, Arnaud Delobelle wrote:
On 22 January 2012 15:19, MRAB wrote:
Here's a solution in Python 3:
input_path = "..."
section_1_path = "..."
section_2_path = "..."
section_3_path = "..."
with open(input_path) as input_file:
try:
line = next(input_file)
On Sun, 22 Jan 2012 05:25:25 +, Steven D'Aprano wrote:
> Or they've been writing Python code since before version 2.2 when True
> and False were introduced, and so they are used to the "while 1" idiom
> and never lost the habit.
That would be me.
As per a now-ancient suggestion on this maili
On 22 January 2012 15:19, MRAB wrote:
> Here's a solution in Python 3:
>
> input_path = "..."
> section_1_path = "..."
> section_2_path = "..."
> section_3_path = "..."
>
> with open(input_path) as input_file:
> try:
> line = next(input_file)
>
> # Copy section 1.
> with o
On 22/01/2012 14:32, Yigit Turgut wrote:
Hi all,
I have a text file approximately 20mb in size and contains about one
million lines. I was doing some processing on the data but then the
data rate increased and it takes very long time to process. I import
using numpy.loadtxt, here is a fragment o
In article
,
Yigit Turgut wrote:
> Hi all,
>
> I have a text file approximately 20mb in size and contains about one
> million lines. I was doing some processing on the data but then the
> data rate increased and it takes very long time to process. I import
> using numpy.loadtxt, here is a frag
Hi all,
I have a text file approximately 20mb in size and contains about one
million lines. I was doing some processing on the data but then the
data rate increased and it takes very long time to process. I import
using numpy.loadtxt, here is a fragment of the data ;
0.06 -0.0004
0.00
On Sun, 22 Jan 2012 03:15:48 -0800, dmitrey wrote:
> hi all,
> could you consider adding __sum__ method, e.g. Python sum(a) checks does
> a have attribute __sum__ and if it has, then a.__sum__() is invoked
> instead of Python sum(a).
> (for my soft FuncDesigner it would be very essential, I guess
hi all,
could you consider adding __sum__ method, e.g. Python sum(a) checks
does a have attribute __sum__ and if it has, then a.__sum__() is
invoked instead of Python sum(a).
(for my soft FuncDesigner it would be very essential, I guess for many
other soft as well, e.g. for PuLP, who has to use lpS
Tim Roberts wrote:
> tinn...@isbd.co.uk wrote:
> >
> >I want to run a server side python script when a button on a web page
> >is clicked. This is on a LAMP server - apache2 on xubuntu 11.10.
> >
> >I know I *could* run it as a CGI script but I don't want to change the
> >web page at all when the
Chris Angelico wrote:
> On Sun, Jan 22, 2012 at 3:36 PM, Tim Roberts wrote:
> > It seems what you're after is AJAX. If you are using a Javascript
> > framework like jQuery, it's easy to fire off an asynchronous request back
> > to your server that leaves the existing page alone.
>
> If you aren
John Nagle writes:
> On 1/19/2012 12:56 AM, Lele Gaifax wrote:
>> John Nagle writes:
>>
>>> "egg" files are usually more trouble than they're worth.
>>
>> I find it really funny you say so, just after another thread where you
>> proved yourself unable to come up with a working Python environment
Le 20/01/12 20:30, Vincent Vande Vyvre a écrit :
Le 20/01/12 19:49, Tamanna Sultana a écrit :
can some one help me??
I would like to create a function that, given a bin, which is a list
(example below), generates averages for t
51 matches
Mail list logo