trip...@gmail.com wrote:
> Need suggestions.
>
> Say, I have a namedtuple like this:
>
> {'a': brucelee(x=123, y=321), 'b': brucelee('x'=123, 'y'=321)
>
> I need to convert it to:
>
> {'a': {'x':123, 'y': 321},'b': {'x':123, 'y': 321}}
>
> Follow-up question --
>
> Which would be easier to w
On Thu, Sep 26, 2013 at 2:23 PM, Nils Bunger wrote:
> Yes, it's email.mime.MIMEApplication. I've pasted a snippet with the imports
> below.
>
> I'm trying to use this to build a multi-part MIME message, with this as one
> part.
>
> I really can't figure out any way to attach a binary part like t
Chris,
Thanks for answering.
Yes, it's email.mime.MIMEApplication. I've pasted a snippet with the imports
below.
I'm trying to use this to build a multi-part MIME message, with this as one
part.
I really can't figure out any way to attach a binary part like this to a
multi-part MIME messa
On Thu, Sep 26, 2013 at 2:38 AM, wrote:
> app = MIMEApplication(b'Q\x0dQ', _encoder=encode_noop)
What is MIMEApplication? It's not a builtin, so your test case is
missing an import, at least. Is this email.mime.MIMEApplication?
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On Thursday, September 26, 2013 4:54:22 AM UTC+5:30, Arturo B wrote:
> So I know what recursion is, but I don't know how is
>
>flatten(i)
>
> evaluated, what value does it returns?
When you are a noob, who do you ask? The gurus.
When you are a guru who do you ask? The co
In article <32f7bdcb-97e5-4a1c-a2c8-ab91e4052...@googlegroups.com>,
melw...@gmail.com wrote:
> Not sure How to proceed on with writing a few more tests with if statement to
> test if the value is low or high. I was told to try a command line switch
> like optparse to pass the number but not sur
On Wed, 25 Sep 2013 15:45:49 -0700, tripsvt wrote:
> Need suggestions.
>
> Say, I have a namedtuple like this:
>
> {'a': brucelee(x=123, y=321), 'b': brucelee('x'=123, 'y'=321)
That's not a namedtuple, that's a dict containing two namedtuples.
> I need to convert it to:
>
> {'a': {'x':123,
On Thu, Sep 26, 2013 at 11:32 AM, Terry Reedy wrote:
> Since CGI uses stdout for the finished product, it could have used stdin for
> the input.
Haven't used CGI in years, but I thought POST data came on stdin?
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
Hello,
I am trying to write a few tests for a random input number game but not too
sure how to proceed on.
I am following the Python Game from http://inventwithpython.com/chapter4.html
Started the tests with a file test_guess.py
from unittest import TestCase
import pexpect as pe
import guess
On 9/25/2013 9:15 PM, MRAB wrote:
On 26/09/2013 02:08, Steven D'Aprano wrote:
On Wed, 25 Sep 2013 18:41:25 -0500, Tim Chase wrote about namedtuple:
While it uses the "private" member-variable "_fields", you can do
It's not actually private!
namedtuple is documented as an exception to the ru
On 9/25/2013 8:11 PM, Steven D'Aprano wrote:
On Wed, 25 Sep 2013 15:18:41 +, Grant Edwards wrote:
The Referer is not an environment variable.
It is when you're writing a CGI app.
How would your shell know what URL you were just browsing?
Because the HTTP server sets those environment
On 26/09/2013 02:08, Steven D'Aprano wrote:
On Wed, 25 Sep 2013 18:41:25 -0500, Tim Chase wrote about namedtuple:
While it uses the "private" member-variable "_fields", you can do
It's not actually private!
namedtuple is documented as an exception to the rule that methods
starting with a sin
On 9/25/2013 7:24 PM, Arturo B wrote:
Hi, I'm doing Python exercises and I need to write a function to flat nested
lists
as this one:
[[1,2,3],4,5,[6,[7,8]]]
To the result:
[1,2,3,4,5,6,7,8]
So I searched for example code and I found this one that uses recursion (that I
don't understand):
On Wed, 25 Sep 2013 18:41:25 -0500, Tim Chase wrote about namedtuple:
> While it uses the "private" member-variable "_fields", you can do
It's not actually private!
namedtuple is documented as an exception to the rule that methods
starting with a single leading underscore are private. Named tup
On 25/9/2013 19:24, Arturo B wrote:
> Hi, I'm doing Python exercises and I need to write a function to flat nested
> lists
> as this one:
>
> [[1,2,3],4,5,[6,[7,8]]]
>
> To the result:
>
> [1,2,3,4,5,6,7,8]
>
> So I searched for example code and I found this one that uses recursion (that
> I do
On 9/25/13 6:45 PM, trip...@gmail.com wrote:
Need suggestions.
Say, I have a namedtuple like this:
{'a': brucelee(x=123, y=321), 'b': brucelee('x'=123, 'y'=321)
I need to convert it to:
{'a': {'x':123, 'y': 321},'b': {'x':123, 'y': 321}}
Namedtuples have a ._asdict() method. You can convert
On Wed, 25 Sep 2013 15:18:41 +, Grant Edwards wrote:
>> The Referer is not an environment variable.
>
> It is when you're writing a CGI app.
>
>> How would your shell know what URL you were just browsing?
>
> Because the HTTP server sets those environment variables before invoking
> the CGI
On Wed, 25 Sep 2013 16:24:22 -0700, Arturo B wrote:
> Hi, I'm doing Python exercises and I need to write a function to flat
> nested lists as this one:
>
> [[1,2,3],4,5,[6,[7,8]]]
>
> To the result:
>
> [1,2,3,4,5,6,7,8]
>
> So I searched for example code and I found this one that uses recursi
On 26/09/2013 00:24, Arturo B wrote:
Hi, I'm doing Python exercises and I need to write a function to flat nested
lists
as this one:
[[1,2,3],4,5,[6,[7,8]]]
To the result:
[1,2,3,4,5,6,7,8]
So I searched for example code and I found this one that uses recursion (that I
don't understand):
d
On Wednesday, September 25, 2013 4:24:22 PM UTC-7, Arturo B wrote:
> Hi, I'm doing Python exercises and I need to write a function to flat nested
> lists
> So I know what recursion is, but I don't know how is
>
>flatten(i)
>
> evaluated, what value does it returns?
>
On 25/09/2013 23:45, trip...@gmail.com wrote:
Need suggestions.
Say, I have a namedtuple like this:
{'a': brucelee(x=123, y=321), 'b': brucelee('x'=123, 'y'=321)
I assume you mean:
{'a': brucelee(x=123, y=321), 'b': brucelee(x=123, y=321)}
I need to convert it to:
{'a': {'x':123, 'y': 32
On 2013-09-25 15:45, trip...@gmail.com wrote:
> Say, I have a namedtuple like this:
>
> {'a': brucelee(x=123, y=321), 'b': brucelee('x'=123, 'y'=321)
>
> I need to convert it to:
>
> {'a': {'x':123, 'y': 321},'b': {'x':123, 'y': 321}}
While it uses the "private" member-variable "_fields", you c
Hi, I'm doing Python exercises and I need to write a function to flat nested
lists
as this one:
[[1,2,3],4,5,[6,[7,8]]]
To the result:
[1,2,3,4,5,6,7,8]
So I searched for example code and I found this one that uses recursion (that I
don't understand):
def flatten(l):
ret = []
for i
Need suggestions.
Say, I have a namedtuple like this:
{'a': brucelee(x=123, y=321), 'b': brucelee('x'=123, 'y'=321)
I need to convert it to:
{'a': {'x':123, 'y': 321},'b': {'x':123, 'y': 321}}
Follow-up question --
Which would be easier to work with if I had to later extract/manipulate the
On 25/09/2013 21:06, mstagliamonte wrote:
Dear All,
Here I am, with another newbie question. I am trying to extract some lines from
a fasta (text) file which match the headers in another file. i.e:
Fasta file:
header1|info1:info2_info3
general text
header2|info1:info2_info3
general text
he
On Wed, 25 Sep 2013 18:16:39 +0300, Νίκος wrote:
> how caom the http_referer thing works ok now but when i just print all
> the key listing of .os.environ ket the http_referer key isnt inside?
That you do not understand this is caused by your failure to understand
the HTTP protocol. You have bee
On 25/9/2013 16:06, mstagliamonte wrote:
> Dear All,
>
> Here I am, with another newbie question. I am trying to extract some lines
> from a fasta (text) file which match the headers in another file. i.e:
> Fasta file:
>>header1|info1:info2_info3
> general text
>>header2|info1:info2_info3
> gener
Dear All,
Here I am, with another newbie question. I am trying to extract some lines from
a fasta (text) file which match the headers in another file. i.e:
Fasta file:
>header1|info1:info2_info3
general text
>header2|info1:info2_info3
general text
headers file:
header1|info1:info2_info3
header2|
Νίκος writes:
> Στις 25/9/2013 5:01 μμ, ο/η Chris “Kwpolska” Warrick έγραψε:
>> On Wed, Sep 25, 2013 at 2:45 PM, Νίκος wrote:
>>> Hello, i decided am ong other os.environ variables to also grab the
>>> 'HTTP_REFERER' fiel but when i try to run my script i was seeing a KeyError
>>> complaining th
On 2013-09-25, ?? wrote:
> 25/9/2013 6:18 , ??/?? Grant Edwards :
>>> The Referer is not an environment variable.
>>
>> It is when you're writing a CGI app.
>>
>>> How would your shell know what URL you were just browsing?
>>
>> Because the HTTP server sets those
Hi,
I'm having trouble encoding a MIME message with a binary file. Newline
characters are being interpreted even though the content is supposed to be
binary. This is using Python 3.3.2
Small test case:
app = MIMEApplication(b'Q\x0dQ', _encoder=encode_noop)
b = io.BytesIO()
g = BytesGenerator
In =?UTF-8?B?zp3Or866zr/Pgg==?=
writes:
> So you mean that even if i run it via shell this stement will also work
> because it happens to be in the same enviroment with the HTTP server?
No. Each process has its own environment. Your shell's environment
knows nothing about the web server's
Στις 25/9/2013 6:18 μμ, ο/η Grant Edwards έγραψε:
On 2013-09-25, Steven D'Aprano wrote:
On Wed, 25 Sep 2013 17:04:55 +0300, ?? wrote:
I would like to check for its existence and retrieve it if possible, if
its not there then default to the string "UnKnown Ref".
I try to do this with:
On 2013-09-25 18:16, Νίκος wrote:
> how caom the http_referer thing works ok now but when i just print
> all the key listing of .os.environ ket the http_referer key isnt
> inside?
Well, first off, it's entirely possible (based on reading that
paragraph) that you typed something wrong.
That said,
Στις 25/9/2013 6:14 μμ, ο/η Tim Chase έγραψε:
On 2013-09-25 18:02, Νίκος wrote:
This indeed works now:
ref = os.environ.get('HTTP_REFERER', 'Άγνωστο Ref')
but iam wondering why this doesnt work also:
ref = os.environ('HTTP_REFERER')
Shouldnt both work?
No...that calls os.environ. You like
On 2013-09-25, Steven D'Aprano wrote:
> On Wed, 25 Sep 2013 17:04:55 +0300, ?? wrote:
>
>> I would like to check for its existence and retrieve it if possible, if
>> its not there then default to the string "UnKnown Ref".
>>
>> I try to do this with:
>>
>> referer = os.environ.get('HTTP_
Στις 25/9/2013 6:04 μμ, ο/η Steven D'Aprano έγραψε:
On Wed, 25 Sep 2013 14:26:23 +, John Gordon wrote:
You could try this:
try:
referer = os.environ.get('HTTP_REFERER', 'UnknownRef')
except KeyError:
referer = None
if not referer:
referer = 'Unknow
On 2013-09-25 18:02, Νίκος wrote:
> This indeed works now:
>
> ref = os.environ.get('HTTP_REFERER', 'Άγνωστο Ref')
>
> but iam wondering why this doesnt work also:
>
> ref = os.environ('HTTP_REFERER')
>
> Shouldnt both work?
No...that calls os.environ. You likely *mean*
ref = os.environ['H
Le mercredi 25 septembre 2013 17:02:45 UTC+2, Ferrous Cranus a écrit :
> Στις 25/9/2013 5:52 μμ, ο/η Steven D'Aprano έγραψε:
>
> > On Wed, 25 Sep 2013 17:04:55 +0300, Νίκος wrote:
>
> >
>
> >> I would like to check for its existence and retrieve it if possible, if
>
> >> its not there then defa
On 9/25/13 10:26 AM, John Gordon wrote:
You could try this:
try:
referer = os.environ.get('HTTP_REFERER', 'UnknownRef')
except KeyError:
referer = None
if not referer:
referer = 'UnknownRef'
There's no need for the "except KeyError" clause. dict.get ne
On Wed, 25 Sep 2013 14:26:23 +, John Gordon wrote:
> You could try this:
>
> try:
> referer = os.environ.get('HTTP_REFERER', 'UnknownRef')
> except KeyError:
> referer = None
> if not referer:
> referer = 'UnknownRef'
The get method will not raise KeyError
Στις 25/9/2013 5:52 μμ, ο/η Steven D'Aprano έγραψε:
On Wed, 25 Sep 2013 17:04:55 +0300, Νίκος wrote:
I would like to check for its existence and retrieve it if possible, if
its not there then default to the string "UnKnown Ref".
I try to do this with:
referer = os.environ.get('HTTP_REFERER',
On 2013-09-25 14:18, John Gordon wrote:
> However, if the user did not arrive from another page, then
> HTTP_REFERER will be missing. This happens when the user types the
> web address directly into their browser, or clicks on a bookmark,
> or many other ways.
>
> Also, obviously, it's up to the
On Wed, 25 Sep 2013 17:04:55 +0300, Νίκος wrote:
> I would like to check for its existence and retrieve it if possible, if
> its not there then default to the string "UnKnown Ref".
>
> I try to do this with:
>
> referer = os.environ.get('HTTP_REFERER', 'UnknownRef')
>
> but that doesn't return
On Wed, 25 Sep 2013 17:07:38 +0300, Νίκος wrote:
> ni...@superhost.gr [~/www/cgi-bin]# python metrites.py
>File "metrites.py", line 27
> host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] or
> 'UnKnown Host'
> ^
> SyntaxError: invalid syntax
>
>
> i dont see anything wr
In =?UTF-8?B?zp3Or866zr/Pgg==?=
writes:
> But one other problem appeared too:
> ni...@superhost.gr [~/www/cgi-bin]# python metrites.py
>File "metrites.py", line 27
> host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] or
> 'UnKnown Host'
> ^
> SyntaxError: invalid syn
In =?UTF-8?B?zp3Or866zr/Pgg==?=
writes:
> referer = os.environ.get('HTTP_REFERER', 'UnknownRef')
> but that doesn't return anything either.
When you say it "doesn't return anything", what exactly do you mean? Does
it return None? Does it raise KeyError? Something else?
In any case, I'm su
On 2013-09-25 15:07, Νίκος wrote:
Στις 25/9/2013 5:01 μμ, ο/η Chris “Kwpolska” Warrick έγραψε:
On Wed, Sep 25, 2013 at 2:45 PM, Νίκος wrote:
Hello, i decided am ong other os.environ variables to also grab the
'HTTP_REFERER' fiel but when i try to run my script i was seeing a KeyError
complaini
In =?UTF-8?B?zp3Or866zr/Pgg==?=
writes:
> referrer = os.environ['HTTP_REFERER']
> Do i miss something? its a suprise to me that the environ dictioanry has
> almost anythign but a referrer key.
HTTP_REFERER is used to indicate the URL containing the link that led
the user to the current URL.
Στις 25/9/2013 5:01 μμ, ο/η Chris “Kwpolska” Warrick έγραψε:
On Wed, Sep 25, 2013 at 2:45 PM, Νίκος wrote:
Hello, i decided am ong other os.environ variables to also grab the
'HTTP_REFERER' fiel but when i try to run my script i was seeing a KeyError
complaining that 'HTTP_REFERER' didnt exist.
Στις 25/9/2013 5:01 μμ, ο/η Chris “Kwpolska” Warrick έγραψε:
On Wed, Sep 25, 2013 at 2:45 PM, Νίκος wrote:
Hello, i decided am ong other os.environ variables to also grab the
'HTTP_REFERER' fiel but when i try to run my script i was seeing a KeyError
complaining that 'HTTP_REFERER' didnt exist.
On Wed, Sep 25, 2013 at 2:45 PM, Νίκος wrote:
> Hello, i decided am ong other os.environ variables to also grab the
> 'HTTP_REFERER' fiel but when i try to run my script i was seeing a KeyError
> complaining that 'HTTP_REFERER' didnt exist.
>
> So, to see what existed in the os.environ dictionary
On Tue, Sep 24, 2013 at 10:39 AM, Mark Lawrence wrote:
> On 24/09/2013 09:09, Osumo Clement wrote:
>>
>> Hi. I am new to Python. I am making a script where logging in to a
>> website is the first step.. I am using Python 3.3 All of the help I have
>> seen online uses urllib2 which in Python 3 ai
Στις 25/9/2013 3:45 μμ, ο/η Νίκος έγραψε:
Hello, i decided am ong other os.environ variables to also grab the
'HTTP_REFERER' fiel but when i try to run my script i was seeing a
KeyError complaining that 'HTTP_REFERER' didnt exist.
So, to see what existed in the os.environ dictionary i issues a p
Hello, i decided am ong other os.environ variables to also grab the
'HTTP_REFERER' fiel but when i try to run my script i was seeing a
KeyError complaining that 'HTTP_REFERER' didnt exist.
So, to see what existed in the os.environ dictionary i issues a print(
os.environ ) to see all available
In article <60f36178-b584-4fcb-8ad9-2dac6052e...@googlegroups.com>,
dwivedi.dev...@gmail.com wrote:
> Hi all,
>
> I am a newbie to python.
>
> I have about 500 search queries, and about 52000 files in which I have to
> find all matches for each of the 500 queries.
Before anybody can even begi
I announce that nexec[1] is ready for Python.
nexec is a system to transfer system call requests. You can use
applications in an nexec server as same as those in your local machine.
nexec is ready for Python now. Furthermore, nexec client for Android is
available. These mean that you can use
On Sep 25, 2013, at 5:43 AM, Robert Kern wrote:
> On 2013-09-24 19:03, Michael Lamport Commons wrote:
>> Dear Members of this list-serve:
>>
>>Would it be possible to build “stacked neural networks” like the one
>> shown in the attached document?
>>
>>You may have a few questio
On 25/9/2013 06:38, J. Bagg wrote:
> So it is just a random sequence of "junk".
>
> It will be a matter of finding the real start of the record (in this
> case a %) and throwing the "junk" away.
Please join the list. Your present habit of starting a new thread for
each of your messages is getti
So it is just a random sequence of "junk".
It will be a matter of finding the real start of the record (in this
case a %) and throwing the "junk" away. I was misled by the note in the
codecs class that BOMs were being prepended. Should have looked more
carefully.
Mea culpa.
--
https://mail.
On 25/9/2013 04:41, dwivedi.dev...@gmail.com wrote:
> Hi all,
>
> I am a newbie to python.
>
> I have about 500 search queries, and about 52000 files in which I have to
> find all matches for each of the 500 queries.
>
> How should I approach this? Seems like the straightforward way to do it woul
On 25 September 2013 09:41, wrote:
> I am a newbie to python.
>
> I have about 500 search queries, and about 52000 files in which I have to
> find all matches for each of the 500 queries.
>
> How should I approach this? Seems like the straightforward way to do it would
> be to loop through each
On 2013-09-24 19:03, Michael Lamport Commons wrote:
Dear Members of this list-serve:
Would it be possible to build “stacked neural networks” like the one
shown in the attached document?
You may have a few questions about the stacked neural network. For
example, what is a stack
Hi all,
I am a newbie to python.
I have about 500 search queries, and about 52000 files in which I have to find
all matches for each of the 500 queries.
How should I approach this? Seems like the straightforward way to do it would
be to loop through each of the files and go line by line compar
64 matches
Mail list logo