Victor Hooi writes:
> ...
I did not read your message body - just your "subject".
Instead of (the potentially insecure) "eval", I use "json.loads"
(combined with a "json.dumps" to get the "json" representation).
See the "json" module documentation.
--
https://mail.python.org/mailman/listinfo/py
On Thursday 20 August 2015 13:59, Victor Hooi wrote:
> Hi,
>
> I have a textfile with a bunch of JSON objects, one per line.
>
> I'm looking at parsing each of these, and extract some metrics from each
> line.
>
> I have a dict called "metrics_to_extract", containing the metrics I'm
> looking a
Hi,
I have a textfile with a bunch of JSON objects, one per line.
I'm looking at parsing each of these, and extract some metrics from each line.
I have a dict called "metrics_to_extract", containing the metrics I'm looking
at extracting. In this, I store a name used to identify the metric, alon
On Thursday 20 August 2015 08:57, Anton wrote:
> Probably a silly question.
> Let's say I have a dictionary mydict and I need to test if a dictionary is
> empty.
>
> I would use
>
> if not mydict:
> """do something"""
>
> But I just came across a line of code like:
>
> if mydict == {}:
>
On Wednesday, June 17, 2015 at 11:00:24 AM UTC-4, kbtyo wrote:
> I would like to have this JSON object written out to a CSV file so that the
> keys are header fields (for each of the columns) and the values are values
> that are associated with each header field. Is there a best practice for
> w
On Thursday, June 18, 2015 at 2:59:11 AM UTC-4, kbtyo wrote:
> Good Evening Everyone:
>
>
> I would like to have this JSON object written out to a CSV file so that the
> keys are header fields (for each of the columns) and the values are values
> that are associated with each header field. Is t
On Wed, Aug 19, 2015 at 6:33 PM, MRAB wrote:
> Well, that depends on the intention.
>
> Is it checking whether the dictionary is empty, or whether it's an
> empty dictionary (and not, say, an empty list)?
>
Sure, that's a possibility. I would argue that "mydict == {}" is also not
the idiomatic w
On 2015-08-19 15:57, Anton wrote:
> Probably a silly question.
> Let's say I have a dictionary mydict and I need to test if a
> dictionary is empty.
>
> I would use
>
> if not mydict:
> """do something"""
>
> But I just came across a line of code like:
>
> if mydict == {}:
> """do some
On 2015-08-20 00:15, Skip Montanaro wrote:
Comparison against {} will be less efficient. You need to create a
dictionary every time instead of just checking the length of your
dictionary, which is likely stored in the header. So, it will work, but
certainly isn't idiomatic Python.
Well, that de
Comparison against {} will be less efficient. You need to create a
dictionary every time instead of just checking the length of your
dictionary, which is likely stored in the header. So, it will work, but
certainly isn't idiomatic Python.
Skip
--
https://mail.python.org/mailman/listinfo/python-li
Probably a silly question.
Let's say I have a dictionary mydict and I need to test if a dictionary is
empty.
I would use
if not mydict:
"""do something"""
But I just came across a line of code like:
if mydict == {}:
"""do something"""
which seems odd to me, but maybe there is a valid
Here is a first shot at a pyparsing parser for these lines:
from pyparsing import *
SET,POLICY,ID,FROM,TO,NAT,SRC,DST,IP,PORT,SCHEDULE,LOG,PERMIT,ALLOW,DENY =
map(CaselessKeyword,
"SET,POLICY,ID,FROM,TO,NAT,SRC,DST,IP,PORT,SCHEDULE,LOG,PERMIT,ALLOW,DENY".split(','))
integer = Word(nums)
ipA
Al Pfalzgraf schrieb am 18.08.2015 um 15:07:
> If a logging file is opened at the level of a Python application, how
> would the log file name be communicated to a C-extension so that logging
> from the extension would be sent to the same log file?
Writing to the file directly (as was suggested) m
On Wednesday, August 19, 2015 at 1:14:44 PM UTC-4, Petite Abeille wrote:
> > On Aug 19, 2015, at 7:01 PM, Denis McMahon wrote:
> >
> > Downloading xml from the web is easy
> >
> > writing csv or txt is easy
> >
> > The tricky bit is converting the xml you have into the csv or text data
> > you
Hi,
Wingware has released version 5.1.6 of Wing IDE, our cross-platform
integrated development environment for the Python programming language.
Wing IDE features a professional code editor with vi, emacs, visual
studio, and other key bindings, auto-completion, call tips,
context-sensitive au
> On Aug 19, 2015, at 7:01 PM, Denis McMahon wrote:
>
> Downloading xml from the web is easy
>
> writing csv or txt is easy
>
> The tricky bit is converting the xml you have into the csv or text data
> you want.
>
curl | xml2 | 2csv
http://www.ofb.net/~egnor/xml2/ref
--
https://mail.pytho
On Wed, 19 Aug 2015 04:57:44 -0700, ryguy7272 wrote:
[stuff]
Downloading xml from the web is easy
writing csv or txt is easy
The tricky bit is converting the xml you have into the csv or text data
you want.
And to do that, you need to understand the structure of the xml data that
you are rec
MRAB wrote:
> On 2015-08-18 22:42, Laurent Pointal wrote:
>> Hello,
>> ellipfind_re = re.compile(r"((?=\.\.\.)|…)", re.IGNORECASE|re.VERBOSE)
>> ellipfind_re.sub(' ... ',
>> "C'est un essai... avec différents caractères… pour voir.")
> (?=...) is a lookahead; a non-capture group is (?:..
MRAB writes:
> On 2015-08-18 22:55, Ben Bacarisse wrote:
>> Neal Becker writes:
>>
>>> Trying regex 2015.07.19
>>>
>>> I'd like to match recursive parenthesized expressions, with groups such that
>>> '(a(b)c)'
>>>
>>> would give
>>> group(0) -> '(a(b)c)'
>>> group(1) -> '(b)'
>>>
>>> but that's
In a message of Wed, 19 Aug 2015 06:32:46 -0700, ryguy7272 writes:
>Well, yes, I was originally trying to do it it R, but I couldn't get
>it working, so I thought I'd try to do it in Python. That was a
>sample R script. Can I do essentially the same thing in Python? Can
>I read the XML from the
>
>
> Well, yes, I was originally trying to do it it R, but I couldn't get it
> working, so I thought I'd try to do it in Python. That was a sample R
> script. Can I do essentially the same thing in Python? Can I read the XML
> from the web?
> http://www.usda.gov/oce/commodity/wasde/report_fo
On Wednesday, August 19, 2015 at 8:21:50 AM UTC-4, Laura Creighton wrote:
> In a message of Wed, 19 Aug 2015 04:57:44 -0700, ryguy7272 writes:
> >I'm trying to get R to download the data from here:
> >
> >http://www.usda.gov/oce/commodity/wasde/report_format/latest-July-2015-New-Format.xml
> >
> >
In a message of Wed, 19 Aug 2015 04:57:44 -0700, ryguy7272 writes:
>I'm trying to get R to download the data from here:
>
>http://www.usda.gov/oce/commodity/wasde/report_format/latest-July-2015-New-Format.xml
>
>
># install and load the necessary package
>install.packages("XML")
>library(XML)
># Sa
On Wed, 19 Aug 2015 04:57 pm, Dwight GoldWinde wrote:
> Please help
>
> Using this code:
>
> import nltk
> nltk.download('maxent_treebank_pos_tagger¹)
>
>
> I get this error:
[...]
>os.mkdir(download_dir)
>
> PermissionError: [Errno 13] Permission denied:
> '/Users/dwightgoldwindex/nltk_
I'm trying to get R to download the data from here:
http://www.usda.gov/oce/commodity/wasde/report_format/latest-July-2015-New-Format.xml
# install and load the necessary package
install.packages("XML")
library(XML)
# Save the URL of the xml file in a variable
xml.url <-
"http://www.usda.gov/o
I have been looking through the threading module and I am
a bit annoyed at the different signatures for indicating
whether some calls should block or not and the timeout.
On the one hand we have the acquire on locks with the following
signature: def accquire(blocking=True, timeout=-1)
On the othe
ANNOUNCING
eGenix.com mxODBC
Python ODBC Database Interface
Version 3.3.5
mxODBC is our commercially supported Python extension providing
Please help
Using this code:
import nltk
nltk.download('maxent_treebank_pos_tagger¹)
I get this error:
[nltk_data] Downloading package maxent_treebank_pos_tagger to
[nltk_data]/Users/dwightgoldwindex/nltk_data...
Traceback (most recent call last):
File "test short.py", line 18, in
n
In a message of Wed, 19 Aug 2015 10:44:53 +0200, Laura Creighton writes:
>I haven't tried this but fabric looks encouraging:
>
>>From
>>http://docs.fabfile.org/en/latest/api/core/operations.html#fabric.operations.run
>
> fabric.operations.run(*args, **kwargs)
>
>Run a shell command on a remote
I haven't tried this but fabric looks encouraging:
>From
>http://docs.fabfile.org/en/latest/api/core/operations.html#fabric.operations.run
fabric.operations.run(*args, **kwargs)
Run a shell command on a remote host.
...
Any text entered in your local terminal will be forwarded to
In a message of Tue, 18 Aug 2015 08:07:51 -0500, Al Pfalzgraf writes:
> If a logging file is opened at the level of a Python application, how would
> the log file name be communicated to a C-extension so that logging from the
> extension would be sent to the same log file?
To convert a file to a
On Tuesday, 18 August 2015 08:27:33 UTC+5:30, hariramm...@gmail.com wrote:
> execute commands as su on remote server
>
> Postby hariram » Mon Aug 17, 2015 4:02 am
> Needed:
> I need to execute commands after doing su to other user on remote server(not
> sudo which doesn't require password) how i
On Tuesday, 18 August 2015 08:27:33 UTC+5:30, hariramm...@gmail.com wrote:
> execute commands as su on remote server
>
> Postby hariram » Mon Aug 17, 2015 4:02 am
> Needed:
> I need to execute commands after doing su to other user on remote server(not
> sudo which doesn't require password) how i
33 matches
Mail list logo