hi,
I try to edit a text file with python 2.7:
* AAPL *
Date: September 07 2018
Time: 14:10:52
Price: ,068,407
Ask: None
High: None
Low: None
Previous Close: ,068,407
Volume: $ 227.35 / $ 221.30
Market Cap: 20.23
but when I write it to a file I get:
{'previous_close': ',068,407', 'volume
HI! I need help putting the output from terminal in a csv file. I work on linux
and I have python 2.7.15. I am running a python program which also runs some
shell scripts.
I need to capture the output from the .sh scripts and put it nicely in a csv
table. I am using "commands.getoutput('bash ex
On Thu, 06 Sep 2018 13:48:54 +0300, Marko Rauhamaa wrote:
> Chris Angelico :
>> The request was to translate this into Python, not to slavishly imitate
>> every possible semantic difference even if it won't actually affect
>> behaviour.
>
> I trust Steven to be able to refactor the code into some
On Fri, 7 Sep 2018 at 14:06, Steven D'Aprano
wrote:
>
> On Thu, 06 Sep 2018 13:48:54 +0300, Marko Rauhamaa wrote:
>
> > Chris Angelico :
> >> The request was to translate this into Python, not to slavishly imitate
> >> every possible semantic difference even if it won't actually affect
> >> behavi
Please study the following to get you started. It looks like JSON output that
you are dealing,
which is good. I added a ", to the "body"-line, because I assume that you
botched that when giving
an example.
```python
#!/usr/bin/env python
import json
output = '''
{
"error" : {
"body"
On 2018-09-07, Steven D'Aprano wrote:
> On Thu, 06 Sep 2018 13:48:54 +0300, Marko Rauhamaa wrote:
>
>> Chris Angelico :
>>> The request was to translate this into Python, not to slavishly imitate
>>> every possible semantic difference even if it won't actually affect
>>> behaviour.
>>
>> I trust
On 07/09/18 13:55, catanaang...@gmail.com wrote:
HI! I need help putting the output from terminal in a csv file. I work on linux
and I have python 2.7.15. I am running a python program which also runs some
shell scripts.
I need to capture the output from the .sh scripts and put it nicely in a
Thanks Thomas,
You are right, this seems the Python home configuration issue.
One more question.
Is there a way I can catch the error ( Fatal Python error: initfsencoding:
..) as exception in the c code ?
try{
Py_Initialize();
}catch(xxx)
{
}
Thanks
On Thu, Sep 6, 2018 at 5:29 PM, Tho
The question "If I do this "aList = enumerate(numList)", isn't it stored
permanently in aList now? I see your point to use it directly, but just in
case I do need to hang onto it from one loop to another, then how is that done?"
Reflects that you are thinking in a C++ kind of way I think.
Whe
alon.naj...@gmail.com wrote:
> hi,
>
> I try to edit a text file with python 2.7:
>
> * AAPL *
> Date: September 07 2018
> Time: 14:10:52
> Price: ,068,407
> Ask: None
> High: None
> Low: None
> Previous Close: ,068,407
> Volume: $ 227.35 / $ 221.30
> Market Cap: 20.23
It looks like the
On Fri, 7 Sep 2018 at 15:10, Paul Moore wrote:
>
> On Fri, 7 Sep 2018 at 14:06, Steven D'Aprano
> wrote:
> >
> > On Thu, 06 Sep 2018 13:48:54 +0300, Marko Rauhamaa wrote:
> >
> > > Chris Angelico :
> > >> The request was to translate this into Python, not to slavishly imitate
> > >> every possibl
On 2018-09-07 17:13, Jason Qian via Python-list wrote:
> Thanks Thomas,
>
> You are right, this seems the Python home configuration issue.
>
> One more question.
>
> Is there a way I can catch the error ( Fatal Python error: initfsencoding:
> ..) as exception in the c code ?
It's a fatal error,
Paul Moore :
> On Fri, 7 Sep 2018 at 15:10, Paul Moore wrote:
>>
>> On Fri, 7 Sep 2018 at 14:06, Steven D'Aprano
>> wrote:
>> > However I have a follow up question. Why the "let" construct in the
>> > first place? Is this just a matter of principle, "put everything in
>> > its own scope as a mat
On 07/09/18 03:40, Steven D'Aprano wrote:
On Thu, 06 Sep 2018 13:06:22 -0700, Ethan Furman wrote:
On 09/06/2018 12:42 PM, Reto Brunner wrote:
What do you think the link, which is attached to every email you
receive from the list, is for? Listinfo sounds very promising, doesn't
it?
And if you
Thanks a lot, I've managed to make it work they way I wanted
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, 7 Sep 2018 at 16:25, Schachner, Joseph
wrote:
>...
> Now, on to the second part: the problem you showed - that you can only loop
> through aList:print(i,j) once - is BECAUSE you hung onto it from one loop to
> another. Once the iterator is exhausted, it's exhausted.
>
> Think of another
Marko Rauhamaa :
> def f(n):
> def auxf1(sum, m, i):
> if i == n:
> return sum
> else:
> def auxf2(sum, m, i):
> if sum % m == 0:
> return auxf1(sum, m + 1, i)
> else
On 2018-09-06 16:00, MRAB wrote:
> On 2018-09-06 21:24, Michael F. Stemper wrote:
>> On 2018-09-06 09:35, Rhodri James wrote:
>>> Is it worth creating the superclass in Python? It sounds like it's a
>>> bit marginal in your case. I'm not that seasoned in object-oriented
>>> design either, but my
On 2018-09-07 14:51, Michael F. Stemper wrote:
> On 2018-09-06 16:00, MRAB wrote:
>> On 2018-09-06 21:24, Michael F. Stemper wrote:
>> A word of advice: don't use a "bare" except, i.e. one that doesn't
>> specify what exception(s) it should catch.
> In another case where I had a "bare exception",
On 2018-09-07 20:51, Michael F. Stemper wrote:
On 2018-09-06 16:00, MRAB wrote:
On 2018-09-06 21:24, Michael F. Stemper wrote:
On 2018-09-06 09:35, Rhodri James wrote:
Is it worth creating the superclass in Python? It sounds like it's a
bit marginal in your case. I'm not that seasoned in o
On 2018-09-07 21:08, Michael F. Stemper wrote:
On 2018-09-07 14:51, Michael F. Stemper wrote:
On 2018-09-06 16:00, MRAB wrote:
On 2018-09-06 21:24, Michael F. Stemper wrote:
A word of advice: don't use a "bare" except, i.e. one that doesn't
specify what exception(s) it should catch.
In an
On 2018-09-07 15:39, MRAB wrote:
> On 2018-09-07 20:51, Michael F. Stemper wrote:
>> On 2018-09-06 16:00, MRAB wrote:
>>> A word of advice: don't use a "bare" except, i.e. one that doesn't
>>> specify what exception(s) it should catch.
>>
>> Given that I moved the first line ("P_0s = ...") out of
On Fri, 07 Sep 2018 16:07:06 -0500, Michael F. Stemper wrote:
>>> In another case where I had a "bare exception", I was using it to see
>>> if something was defined and substitute a default value if it wasn't.
>>> Have I cleaned this up properly?
>>>
>>> try
>>> id = xmlmodel.attrib['name']
On Fri, 07 Sep 2018 07:39:33 +0300, Marko Rauhamaa wrote:
> I'm with Ethan on this one.
>
> There was nothing in the original posting that merited ridicule.
Then its a good thing there was nothing in the response that was ridicule.
(A mild rebuke for a mild social faux pas is not ridicule.)
-
On Fri, 07 Sep 2018 15:10:10 +0100, Paul Moore wrote:
> On Fri, 7 Sep 2018 at 14:06, Steven D'Aprano
> wrote:
[...]
>> However I have a follow up question. Why the "let" construct in the
>> first place? Is this just a matter of principle, "put everything in its
>> own scope as a matter of precau
25 matches
Mail list logo