no doubt tho after playing with this is that enumerate value ends up in the
output which is a dictionary. The enumerate has no key which makes it invalid
json if dumped.
Not massive issue but getting the effect of enumerate without polluting output
would be the winner.
>runner_lists = {}
https://youtu.be/eblAxa5iO24. The video is just an introduction for a course on
https://studyscienceblog.wordpress.com/2017/10/28/university-of-mitchigan-s-courses
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, 4 Nov 2017 04:44 am, Jon Ribbens wrote:
> On 2017-11-03, Steve D'Aprano wrote:
>> The for loop does not necessarily perform a search:
>>
>> count = 1
>> for obj in sequence:
>> if count > MAX_OBJECTS:
>> print("too many objects, halting")
>> break
>> process(obj)
>
Steve D'Aprano writes:
> On Sun, 5 Nov 2017 06:42 am, Stefan Ram wrote:
>
> > What is the one way to do it?
>
> There is no philosophy of "one way to do it" in Python, that is a
> misunderstanding (possibly deliberate...) spread about by Perl users,
> to contrast Python from Perl's "more than one
On Sun, 5 Nov 2017 04:32 am, Steve D'Aprano wrote:
> I'm trying to dump a Firefox IndexDB sqlite file to text using Python 3.5.
>
>
> import sqlite3
> con = sqlite3.connect('foo.sqlite')
> with open('dump.sql', 'w') as f:
> for line in con.iterdump():
> f.write(line + '\n')
Never m
On Sun, 5 Nov 2017 06:42 am, Stefan Ram wrote:
> What is the one way to do it?
There is no philosophy of "one way to do it" in Python, that is a
misunderstanding (possibly deliberate...) spread about by Perl users, to
contrast Python from Perl's "more than one way to do it".
The Zen of Python sa
On 04Nov2017 01:47, Chris Angelico wrote:
On Fri, Nov 3, 2017 at 8:24 PM, Ali Rıza KELEŞ wrote:
Yesterday, while working with redis, i encountered a strange case.
I want to ask why is the following `True`
```
"s" is b"s".decode()
```
while the followings are `False`?
```
"so" is b"so".deco
On 11/4/2017 3:42 PM, Stefan Ram wrote:
What is better:
...
import math
...
... math.cos ...
...
or
...
from math import cos
...
... cos ...
...
?
(To me, the first is more readable, because at the site
where »math.cos« is used, it is made clear that »cos«
comes from math.
On 04Nov2017 17:43, Sayth Renshaw wrote:
figured it. Needed to use n to iterate when creating.
Yeah, my mistake.
runner_lists = {}
for n, item in enumerate(result):
# if this one is interested / not -filtered:
print(n, item)
runner_lists[n] = result[n]["RacingFormGuid
Sorry
figured it. Needed to use n to iterate when creating.
runner_lists = {}
for n, item in enumerate(result):
# if this one is interested / not -filtered:
print(n, item)
runner_lists[n] = result[n]["RacingFormGuide"]["Event"]["Runners"]
Sayth
--
https://mail.python
> I'd just keep the interesting runners, along with their race numbers, in a
> dict. The enumerate function is handy here. Something like (untested):
>
> runner_lists = {}
> for n, item in enumerate(result):
> if this one is interested/not-filtered:
> runner_lists[n] = result["Raci
On Sun, 5 Nov 2017 03:07 am, Karsten Hilbert wrote:
> Try in an interactive interpreter:
>
>python> "a string" is True
Did you try that yourself?
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.org/mailm
Jon Ribbens writes:
> On 2017-11-04, Ben Finney wrote:
> > To respond to the criticism of an idea – criticism containing no
> > mention of the person – as though it “clearly refers to the
> > [person]”, is of significant concern on a software dicussion forum
> > such as this.
>
> No, the thing t
On Sunday, 5 November 2017 04:32:26 UTC+11, Steve D'Aprano wrote:
> I'm trying to dump a Firefox IndexDB sqlite file to text using Python 3.5.
>
>
> import sqlite3
> con = sqlite3.connect('foo.sqlite')
> with open('dump.sql', 'w') as f:
> for line in con.iterdump():
> f.write(line +
On Sunday, 5 November 2017 09:53:37 UTC+11, Cameron Simpson wrote:
> >I want to get a result from a largish json api. One section of the json
> >structure returns lists of data. I am wanting to get each resulting list
> >returned.
> >
> >This is my code.
> >import json
> >from pprint import ppr
On 04Nov2017 20:59, Peter J. Holzer wrote:
On 2017-11-04 19:42, Stefan Ram wrote:
What is better:
...
import math
...
... math.cos ...
or
...
from math import cos
...
... cos ...
?
(To me, the first is more readable, because at the site
where »math.cos« is used, it is made clear th
On 04Nov2017 14:01, Sayth Renshaw wrote:
I want to get a result from a largish json api. One section of the json
structure returns lists of data. I am wanting to get each resulting list
returned.
This is my code.
import json
from pprint import pprint
with open(r'/home/sayth/Projects/results/
Hi
I want to get a result from a largish json api. One section of the json
structure returns lists of data. I am wanting to get each resulting list
returned.
This is my code.
import json
from pprint import pprint
with open(r'/home/sayth/Projects/results/Canterbury_2017-01-20.json', 'rb') as
f
On 2017-11-04 19:42, Stefan Ram wrote:
> What is better:
>
> ...
> import math
> ...
> ... math.cos ...
> ...
>
> or
>
> ...
> from math import cos
> ...
> ... cos ...
> ...
>
> ?
>
> (To me, the first is more readable, because at the site
> where »math.cos« is used, it is made clear tha
On Fri, Nov 03, 2017 at 07:31:56AM +0100, dieter wrote:
> > I have posted backtraces taken from the address being
> > watched. Does that help any at all ?
>
> Only in the case that the error is "local", i.e. detected
> (quite) immediately.
>
> You might be in this case as you have observed that
On Sat, Nov 04, 2017 at 05:07:26PM +0100, Karsten Hilbert wrote:
> Try in an interactive interpreter:
>
>python> "a string" is True
Or, rather,
python> if 'a string': print 'success'
Sorry,
Karsten
--
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD 4537
Steve D'Aprano wrote:
> I'm trying to dump a Firefox IndexDB sqlite file to text using Python 3.5.
>
>
> import sqlite3
> con = sqlite3.connect('foo.sqlite')
> with open('dump.sql', 'w') as f:
> for line in con.iterdump():
> f.write(line + '\n')
>
>
> The error I get is:
>
> Trace
Try in an interactive interpreter:
python> "a string" is True
Karsten
> Gesendet: Samstag, 04. November 2017 um 16:31 Uhr
> Von: "brandon wallace"
> An: python-list@python.org
> Betreff: Try: Except: evaluates to True every time
>
>
> I have this code that tests a server to see if it is lis
I'm trying to dump a Firefox IndexDB sqlite file to text using Python 3.5.
import sqlite3
con = sqlite3.connect('foo.sqlite')
with open('dump.sql', 'w') as f:
for line in con.iterdump():
f.write(line + '\n')
The error I get is:
Traceback (most recent call last):
File "", line 2,
On Sun, 5 Nov 2017 02:31 am, brandon wallace wrote:
>
> I have this code that tests a server to see if it is listening on port 123
> runs and evaluates to True every time. Even if the server does not exist but
> it is not supposed to do that. I am getting no error message at all. What is
> going
I have this code that tests a server to see if it is listening on port 123 runs
and evaluates to True every time. Even if the server does not exist but it is
not supposed to do that. I am getting no error message at all. What is going on
with this code?
#!/usr/bin/env python
import socket
On Sun, Nov 5, 2017 at 2:31 AM, brandon wallace wrote:
>
> I have this code that tests a server to see if it is listening on port 123
> runs and evaluates to True every time. Even if the server does not exist but
> it is not supposed to do that. I am getting no error message at all. What is
> g
On Sat, Nov 4, 2017 at 11:22 PM, Jon Ribbens wrote:
> On 2017-11-04, Michael Torrie wrote:
>> On 11/03/2017 09:06 PM, Chris Angelico wrote:
>>> On Sat, Nov 4, 2017 at 1:57 PM, Michael Torrie wrote:
On 11/03/2017 07:09 PM, Steve D'Aprano wrote:
> That's incorrect. There are multiple ways
Tim,
it won't even advance to that line.
On Thu, Nov 2, 2017 at 8:28 AM, Tim Williams wrote:
> On Wednesday, November 1, 2017 at 6:30:27 PM UTC-4, Andrew Z wrote:
> > nope. it doesnt:
> >
> > I added print-s after each line and that produced:
> > [az@hp src]$ cat ./main1.py
> > import matplotli
On Sat, Nov 4, 2017 at 11:25 PM, Jon Ribbens wrote:
> On 2017-11-04, Ben Finney wrote:
>> To respond to the criticism of an idea – criticism containing no mention
>> of the person – as though it “clearly refers to the [person]”, is of
>> significant concern on a software dicussion forum such as t
On 2017-11-04, Ben Finney wrote:
> To respond to the criticism of an idea – criticism containing no mention
> of the person – as though it “clearly refers to the [person]”, is of
> significant concern on a software dicussion forum such as this.
No, the thing that is "of significant conern on a so
On 2017-11-04, Michael Torrie wrote:
> On 11/03/2017 09:06 PM, Chris Angelico wrote:
>> On Sat, Nov 4, 2017 at 1:57 PM, Michael Torrie wrote:
>>> On 11/03/2017 07:09 PM, Steve D'Aprano wrote:
That's incorrect. There are multiple ways to exit a loop that
will prevent the `else` block fro
32 matches
Mail list logo