Xah Lee wrote:
> (circa 1996), and email should be text only (anti-MIME, circa 1995),
I think e-mail should be text only. I have both my email and news
readers set to display in plain text only. It prevents the marketeers
and spammers from obtaining feedback that my email address is valid. A
Mike Schilling wrote:
> "l v" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
>>Xah Lee wrote:
>>
>>>(circa 1996), and email should be text only (anti-MIME, circa 1995),
>>
>>I think e-mail should be text only. I have
Thomas Bartkus wrote:
> On Sun, 28 Aug 2005 23:11:09 +0200, billiejoex wrote:
>
> > Hi all. I'd need to aproximate a given float number into the next (int)
> > bigger one. Because of my bad english I try to explain it with some example:
> >
> > 5.7 --> 6
> > 52.987 --> 53
> > 3.34 --> 4
> > 2.1 -->
Grant Edwards wrote:
> On 2005-08-30, Devan L <[EMAIL PROTECTED]> wrote:
> >
> > RoundToInt(2.0) will give you 3.
>
> That's what the OP said he wanted. The next bigger integer
> after 2.0 is 3.
>
> --
> Grant Edwards
Kevin Little wrote:
> I want to dynamically add or replace bound methods in a class. I want
> the modifications to be immediately effective across all instances,
> whether created before or after the class was modified. I need this
> to work for both old ('classic') and new style classes, at both
talin at acm dot org wrote:
> Thanks for all the respones :) I realized up front that this suggestion
> is unlikely to gain approval, for reasons eloquently stated above.
> However, there are still some interesting issues raised that I would
> like to discuss.
>
> Let me first respond to a few of t
Xah Lee wrote:
> what's the decision? any reference to the discussion?
>
> i thought it is better for Python to have one single recognizable logo.
> Perhaps python doesn't have a logo and the official python people
> decided it shouldn't or just doesn't have one currently?
>
> of course, a logo he
billiejoex wrote:
> Hi all. I'm sorry for a noob question like this but I'll try to ask it
> anyway.
> One of the greatest problem that may discourage a new user to choose Python
> language is it's interpreted nature.
What? The instant gratification of immediate results is not
discouraging.
> Ano
LOPEZ GARCIA DE LOMANA, ADRIAN wrote:
> Hi all,
>
> I have a question with some code I'm writting:
>
>
> def main():
>
> if option == 1:
>
> function_a()
>
> elif option == 2:
>
> function_b()
>
> else:
>
> raise 'option has to be either 1 or 2'
>
> if itera
[EMAIL PROTECTED] wrote:
> Hey guys, i just started learning python (i usually use java/C).
>
> this has got me stumped as its not mentioned in the documentation
> (unless im skimming it every time).
>
> How does one instanciate a class from another file
import somefile
foo = somefile.class(__ini
hi, everybody here,
I am a newbie to python. I encounter a problem that how to convert
an array of numarray to pil object. For example, the data in an image
is extracted using Image.getdata, then the data are converted into an
array in numarray. But when the array is needed to convert to the
Thanks. But some problems remain.
I have known using Image.tostring/fromstring and
numarray.tostring/fromstring can do the job. But when confronting
multi-spectral images, e.g., RGB color images, I don't know how to do
it. Could you give some advices on that?
You wrote "In [14]: img = Image.fromb
In Python interactive mode, is there some function acting like 'clear'
command in bash? Could somebody here give some advice?
Thanks in advance.
--
http://mail.python.org/mailman/listinfo/python-list
Sorry, I make the mistakes. I have known how to use to/fromstring
method to interface between PIL and Numarray.
And your code does work.
Another question. Just like the code you provide, is it possible to
directly load image data from PIL to Numarray array without use of
to/fromstring method?
Thank you very much. I have tested it under Cygwin, and that works. But
it fails under Windows Python Shell Mode.
--
http://mail.python.org/mailman/listinfo/python-list
I am writing the code involved in numerical computation. When I need a
float epsilon similar to FLT_EPS in C, eps in matlab, I fail to find
the equivalent in python. Could somebody here can give me some advices?
--
http://mail.python.org/mailman/listinfo/python-list
I have tested it under windows python console, and it works.
Thank you very much.
--
http://mail.python.org/mailman/listinfo/python-list
Thank you very much.
I have searched in python's documentation, and I am sure that python
doesn't provide an epsilon.
--
http://mail.python.org/mailman/listinfo/python-list
According to pp 134 of "C: A Reference Manual", it's better to use
eps*2 in your code.
--
http://mail.python.org/mailman/listinfo/python-list
Ray wrote:
> Hello,
>
> I'm just reading the latest edition of Python Cookbook, where it says
> in Recipe 4.2:
>
> "when the op you wanna perform on each item is to call a function on
> the item and use the function's result, use L1 = map(f, L), rather than
&
I need to be able to programatically get the version info from a windows
DLL preferably in the same format as what is displayed in the properties
tab.
I was overjoyed to find Mark Hammond's Python Extensions
(http://starship.python.net/crew/mhammond/) The package includes a
little demo progr
Sorry, I seem to be missing the replies! I will stop posting!
Peter Hansen wrote:
xytho33 wrote:
I need to be able to programatically get the version info from a windows
DLL preferably in the same format as what is displayed in the properties
tab.
(Posted and mailed)
Your posts are making it to t
I've hit a brick wall on something that I'm guessing is pretty simple but
it's driving me nuts. I noticed that with python lists, generally when you
make a copy of a list (ie, List1 = List2) List1 just becomes a reference to
List2 and any modifications done to List1 affects List2. Ok I can live wit
> See copy.deepcopy(). It will make sure that everything gets copied and
> nothing just referenced (more or less).
So far copy.deepcopy() seems to be working perfectly.
Thanks for the input
Nick
--
http://mail.python.org/mailman/listinfo/python-list
Thanks, thats a really handy function
"Ron_Adam" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sun, 27 Mar 2005 09:01:20 GMT, "Nick L" <[EMAIL PROTECTED]>
> wrote:
>
> >I've hit a brick wall on something that I'm guess
Laura, thanks for the answer - it works. Is there some equivalent of
"include" to expose every function in that script?
Thanks again,
-V
On Tue, Feb 10, 2015 at 7:16 PM, Laura Creighton wrote:
> In a message of Wed, 11 Feb 2015 01:06:00 +0100, Laura Creighton writes:
> >In a message of Tue, 10 F
me': 'hostname8', 'ip_addr': ''},
{'hostname': 'hostname200', 'ip_addr': 'xxx.xx.xxx.200'},
{'hostname': 'hostname300', 'ip_addr': 'xxx.xx.xxx.400'},
)
trying to get the following difference from the above dictionary
1). compare the value of 'ip' in output1 dictionary with either 'hostname'
and 'ip_addr' output2 dictionary and print their intersection. Tried below
code:
for doc in output1:
for row in output2:
if((row["hostname"] == doc["ip"]) or (row["ip_addr"] ==
doc["ip"])):
print doc["ip"],doc["count"]
*output:*
hostname1 212
hostname2 27
hostname10 1
hostname8 2
xxx.xx.xxx.11 3
xxx.xx.xxx.12 90
xxx.xx.xxx.13 12
xxx.xx.xxx.14 21
xxx.xx.xxx.15 54
xxx.xx.xxx.16 34
2). need to print the below output if the value of 'ip' in output1
dictionary is not there in in output2 dictionary(ip/hostname which is there
in output1 and not there in output2):
xxx.xx.xxx.1 3
xxx.xx.xxx.2 4
xxx.xx.xxx.3 8
xxx.xx.xxx.4 10
hostname3 513
hostname4 98
xxx.xx.xxx.17 11
xxx.xx.xxx.18 2
xxx.xx.xxx.19 19
xxx.xx.xxx.20 21
xxx.xx.xxx.21 25
xxx.xx.xxx.22 31
xxx.xx.xxx.23 43
xxx.xx.xxx.24 46
xxx.xx.xxx.25 80
xxx.xx.xxx.26 91
xxx.xx.xxx.27 90
xxx.xx.xxx.28 10
xxx.xx.xxx.29 3
3). Ip address with is there only in output2 dictionary.
xxx.xx.xxx.200
xxx.xx.xxx.400
Any help would be really appreciated. Thank you
Thanks
Mohan L
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, Oct 4, 2013 at 12:14 AM, MRAB wrote:
> On 03/10/2013 17:11, Mohan L wrote:
>
>> Dear All,
>>
>> I have two list of dictionaries like below:
>>
>> In the below dictionaries the value of ip can be either hostname or ip
>> address.
>>
&
Hello,
I am trying to get some old plugins I wrote to wrote on anewer version of
rhythmbox.
When I try to load the plugin I see:
(rhythmbox:3092): libpeas-WARNING **: nowplaying-lcd:
/usr/lib/rhythmbox/plugins/nowplaying-lcd/libnowplaying-lcd.so: cannot open
shared object file: No such file or d
I'm a graphic designer. I'm new to Python. I know html, css, alittle
actioscript and little javascript. I actually build an iOS using Flash. I
understand programming concepts I believe.
I'd like to build a Illustrator/Photoshop like program. Why, there are some
features that I'd like to persona
Well 15 years ago when I was 15 I wanted to model cars in 3D. It took me 100
hours and 5-10 years but I can modeling a realistic vehicle and other objects
in 3d. It was time consuming and challenging but it was worth it. And honestly
I've used my 3d modeling skills to build displays and products
I tried to use gimp but as a photoshop user it was horrible. I was trying to
like it. That is a great idea tearing down gimp. that is how I learn html and
css. Breakin down websites.
--
https://mail.python.org/mailman/listinfo/python-list
No don't tell me what to do. I joined the military 3 years ago. You wouldn't
believe the stuff I wasn't able to do before but now I am. You can keep your
advice to yourself. I wasn't asking for something simple. I was asking for a
starting point. The 3d was to show you I've learned hard stuff an
On 13-03-11 10:42 AM, Shiyao Ma wrote:
Today I come across a problem.
Basically, my need is that I want to launch a http server that can not
only support get but also support post (including post file).
My first idea is to use -m http.sever. However, it only supports get.
Later I find some one ex
Antoon Pardon wrote:
> On 2005-12-10, Duncan Booth <[EMAIL PROTECTED]> wrote:
[snip]
> >> I also think that other functions could benefit. For instance suppose
> >> you want to iterate over every second element in a list. Sure you
> >> can use an extended slice or use some kind of while. But why n
amfr wrote:
> I am writing a webserver, and I want it to be able to run python
> scripts. But when I set sys.stdin to self.rfile (using the
> BaseHTTPServer class, self.rfile is a input stream containing the
> request), the cgi module does not parse the data.
> Example script:
> import cgi
> form
Mike Meyer wrote:
> Ok, I've given it the interface I want, and made it less of an
> attractive nuisance.
>
> http://www.mired.org/home/mwm/try_python/ is now ready for people to
> play with. There's no tutorial information on it yet, that's the next
> thing to do. However, I won't be able to work
I've spent a while putting together a partially working Try Python
which handles class and function definitions. It also (used to) work
with imports, but my hacked version of jelly doesn't work with it
anymore, so only import this works as far as I know. It won't play nice
if you store the id of an
Steve Holden wrote:
> Devan L wrote:
[what I said]
> At first I thought 'the cgitb TypeError message from "import os" is
> impressively drastic :-)'. Then I realised in a later session that
> "import os" only gave an error message after I'd run &qu
Mike Meyer wrote:
> After spending time I should have been sleeping working on it, the try
> python site is much more functional. It now allows statements,
> including multi-line statements and expressions. You can't create code
> objects yet, so it's still more a programmable calculator than
> an
Mike Meyer wrote:
> "Devan L" <[EMAIL PROTECTED]> writes:
> >> If you want to try an online P{ython tool that lets you save code, try
> >> Devan L's at http://www.datamech.com/devan/trypython/trypython.py.
> > My code uses one of the recipes from th
ccc wrote:
> [snip] We are just your basic IT shop, system
> and network administration, hardware, help desk, the web site, and
> database administration. This is also the reason for the 'bad code' (
> which we have in abundance.) People who are not programmers and whose
> job it isn't to program w
[EMAIL PROTECTED] wrote:
> I like the form, no matter what its limitations may be. Three notes:
>
> It might be a good way to catch newbi mistakes (those are the kind I
> make :P, thereby providing a feedback loop to improved error messages.
>
> I had no trouble with from math import * followed b
Mike Meyer wrote:
> [EMAIL PROTECTED] writes:
[comments about Mike Meyer's try python, I think]
> > I had no trouble with from math import * followed by print pi, but
> > there was no >>> prompt after the result appeared .. is that part of
> > the 'closures' thing mentioned earlier?
>
> Hmm. Are y
Mike Meyer wrote:
> Xavier Morel <[EMAIL PROTECTED]> writes:
[Old message and Xavier's question]
[Mike's reply to Xavier]
>
> > Since Python doesn't have any way to secure the interface built-in,
> > i'd be interrested in that.
>
> Devan apparently doesn't have as cooperative an ISP, and is working
It's been a while since I've done anything, and I have finals, so if
anyone wants to look at some of the source, here's the somewhat cleaned
up source for bastille and modjelly. Bastille is just a
sort-of-more-secure equivalent of what the code module is, in case you
have no clue what it does since
Graham wrote:
> I've been messing around with trying to get a small sandbox like
> environment where i could execute python code in a "safe" way.
> Basically what the old restricted execution module attempted to do.
> I've written a small amount of code to get custom interpreter running,
> but i'm
How do I list the members of a class? Meaning, how do I know what are the
functions a particular class has, if i do not want to manually browse through
the class?
N
Never miss a thing. Make Yahoo your
Is there any safe way to create an instance of an untrusted class
without consulting the class in any way? With old-style classes, I can
recreate an instance from another one without worrying about malicious
code (ignoring, for now, malicious code involving attribute access) as
shown below.
>>> im
Ben Finney wrote:
> "Devan L" <[EMAIL PROTECTED]> writes:
>
> > Is there any safe way to create an instance of an untrusted class
>
> Why are you instantiating classes you don't trust?
>
> > without consulting the class in any way?
> If you
Michael Spencer wrote:
> Devan L wrote:
> > Is there any safe way to create an instance of an untrusted class
> > without consulting the class in any way? With old-style classes, I can
> > recreate an instance from another one without worrying about malicious
> &
://seul.org/svn/pygame/branches/msi
--
Lenard Lindstrom
"[EMAIL PROTECTED]" % ('len-l', 'telus', 'net')
--
http://mail.python.org/mailman/listinfo/python-list
python 2.5
Since it was an indirect suggestion, I thought it belonged here.
What should python-list and python-dev both be used for?
I know there is an alternative, but why not make it easier?
From: Matthieu Brucher <[EMAIL PROTECTED]>
To: L V <[EMAIL
I'm developing a PyQt4 application.
I have created a button:
...
self.start_button=QtGui.QPushButton("start simulation", self)
...
that is connected to a function:
...
self.connect(self.start_button, QtCore.SIGNAL('clicked()'),
self.simulate)
...
This is the function:
...
def simulate(self):
On 16 Apr, 20:17, "Diez B. Roggisch" wrote:
> l.fres...@gmail.com schrieb:
>
>
>
> > I'm developing a PyQt4 application.
>
> > I have created a button:
> > ...
> > self.start_button=QtGui.QPushButton("start simulation", self)
> > ...
>
> > that is connected to a function:
> > ...
> > self.connect(
cter in barEdit, and then
delete the character from barEdit I get an unhandled win32 exception occured
in python.exe on windows and segfault on linux.
If I type a character in fooEdit, delete it, and then type a character in
barEdit I get:
{'foo': PyQt4.QtCore.QString(u'a'),
"Phil Thompson" wrote in message
news:mailman.4664.1240907352.11746.python-l...@python.org...
> On Tue, 28 Apr 2009 03:53:34 +0200, "Denis L" wrote:
>> Hello,
>>
>> I'm experiencing odd errors on both windows and linux with the following
>>
"Phil Thompson" wrote in message
news:mailman.4690.1240925876.11746.python-l...@python.org...
> On Tue, 28 Apr 2009 14:54:41 +0200, "Denis L" wrote:
>> "Phil Thompson" wrote in message
>> news:mailman.4664.1240907352.11746.python-l...@python.
"Phil Thompson" wrote in message
news:mailman.4699.1240932385.11746.python-l...@python.org...
> If there was a bug with lambda slots it's been fixed by now.
I just tried it and I'm getting the same errors with regular functions.
Could you try running the code bell
"Phil Thompson" wrote in message
news:mailman.4719.1240945001.11746.python-l...@python.org...
> On Tue, 28 Apr 2009 19:07:30 +0200, "Denis L" wrote:
>> "Phil Thompson" wrote in message
>> news:mailman.4699.1240932385.11746.python-l...@python.org..
it is not
critical then the SDL library will just use msvcrt.dll for Pygame and
Python 2.6.
--
Lenard Lindstrom
"[EMAIL PROTECTED]" % ('len-l', 'telus', 'net')
--
http://mail.python.org/mailman/listinfo/python-list
C run-time such as msvcrt?
--
Lenard Lindstrom
"[EMAIL PROTECTED]" % ('len-l', 'telus', 'net')
--
http://mail.python.org/mailman/listinfo/python-list
Christian Heimes wrote:
L. Lindstrom schrieb:
I have read that Python extension modules must link to the same C
run-time as the Python interpreter. This I can appreciate. But does this
requirement extend to the C libraries an extension module wraps. The
case in point is Pygame and SDL. The
sturlamolden wrote:
On Apr 30, 8:06 pm, "L. Lindstrom" <[EMAIL PROTECTED]> wrote:
I have read that Python extension modules must link to the same C
run-time as the Python interpreter. This I can appreciate. But does this
requirement extend to the C libraries an extension modu
L. Lindstrom wrote:
Christian Heimes wrote:
L. Lindstrom schrieb:
[snip]
[B]esides heap management and FILE pointers, is there any reason SDL, or
any C dependency, needs to link to the same C run-time as Python? If I
ensure SDL frees memory it allocates and does not directly access a file
hello
could you remove this old post, off topic and spam
http://www.mail-archive.com/python-list@python.org/msg175722.html
thank you
_
We are your photos. Share us now with Windows L
(Note: If you just skim this and can tell me how to pass data from an
external program to a web form, that's all I need, and the rest is
just what I'd like to have.)
This is probably extremely simple when you know what you're doing. I
figured I'd see if I could find a kind soul who
could give me s
I have installed pan, but I fail to make it work with "news:comp.lang.python";
I tried adding the name as a newsserver and left all other info like Port,
username and password empty.
Stil I don't get any messages.
How to fix this.
Also I'm completely new to newsgroups.
--
http://mail.pyt
http://www.mail-archive.com/python-list@python.org/msg175722.html
hello could you remove above post... off topic and spam
thank you --
http://mail.python.org/mailman/listinfo/python-list
On 3/7/2017, Sayth Renshaw wrote:
> I have got this dictionary comprehension and it
> works but how can I do it better?
>
> from collections import Counter
>
> def find_it(seq):
> counts = dict(Counter(seq))
> a = [(k, v) for k,v in counts.items() if v % 3 == 0]
> return a[0][0]
>
On 3/1/2017, Sayth Renshaw wrote:
> How can I flatten just a specific sublist of each list in a list of lists?
>
> So if I had this data
>
>
> [ ['46295', 'Montauk', '3', '60', '85', ['19', '5', '1', '0 $277790.00']],
> ['46295', 'Dark Eyes', '5', '59', '83', ['6', '4', '1', '0 $105625.00
On 1/18/2017, Peter Otten wrote:
> with partite.txt looking like this
>
> > 74' Kessie'
> > 90' + 4' D'alessandro
> > 51' Mchedlidze
> > 54' Banega
> > 56' Icardi
> > 65' Icardi
> > 14' Sau
>
>
> Assuming you want to perform a numerical sort on the numbers before the '
> you can just apply sor
On 1/8/2017, Steven D'Aprano wrote:
> Suppose you have an expensive calculation that gets used two or
> more times in a loop. The obvious way to avoid calculating it
> twice in an ordinary loop is with a temporary variable:
>
> result = []
> for x in data:
> tmp = expensive_calculation(x)
>
> > I have a string which is returned by a C extension.
> >
> > mystring = '(1,2,3)'
> >
> > HOW can I read the numbers in python ?
>
> re.findall seems the safest and easiest solution:
>
> >>> re.findall(r'(\d+)', '(1, 2, 3)')
> ['1', '2', '3']
> >>> map(int, re.findall(r'(\d+)', '(1, 2, 3)'))
>
I was doing some work with the ldap module and required a ci dict that was case
insensitive but case preserving. It turned out the cidict class they
implemented was
broken with respect to pop, it is inherited and not re implemented to work.
Before
I set about re-inventing the wheel, anyone know o
I have some data I am working with that is not being interpreted as a string
requiring
base64 encoding when sent to the ldif module for output.
The base64 string parsed is ZGV0XDMzMTB3YmJccGc= and the raw string is
det\3310wbb\pg.
I'll admit my understanding of the handling requirements of non a
> Can you give an example of the code you have?
I actually just overrode the regex used by the method in the LDIFWriter class
to be far more broad
about what it interprets as a safe string. I really need to properly handle
reading, manipulating and
writing non ascii data to solve this...
Shame
> I have been doing the same thing and I tried to use java for testing the
> credentials and they are correct. It works perfectly with java.
> I really don´t know what we´re doing wrong.
>
>
> You are accessing a protected operation of the LDAP server
> and it (the server) rejects it due to invali
> I'm not sure what exactly you're asking for.
> Especially "is not being interpreted as a string requiring base64 encoding" is
> written without giving the right context.
>
> So I'm just guessing that this might be the usual misunderstandings with use
> of base64 in LDIF. Read more about when LDI
x27;.join([attr_type,base64.encodestring(attr_value).replace('\n','')]))
File "C:\Python27\lib\base64.py", line 315, in encodestring
pieces.append(binascii.b2a_base64(chunk))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xdf'
> Note that all modules in python-ldap up to 2.4.10 including module 'ldif'
> expect raw byte strings to be passed as arguments. It seems to me you're
> passing a Unicode object in the entry dictionary which will fail in case an
> attribute value contains NON-ASCII chars.
Yup, I was.
> python-lda
I have a use where writing an interim file is not convenient and I was hoping to
iterate through maybe 100k lines of output by a process as its generated or
roughly anyways.
Seems to be a common question on ST, and more easily solved in Linux.
Anyone currently doing this with Python 2.7 in windows
> You leave out an awful amount of detail. I have no idea what ST is, so
> I'll have to guess your real problem.
Ugh, sorry guys its been one of those days, the post was rather useless...
I am using Popen to run the exe with communicate() and I have sent stdout to
PIPE
without luck. Just not su
I bet this is asked quite frequently, however after quite a few hours searching
I haven't found an answer.
What is the thinking behind stopping 'one short' when slicing or iterating
through lists?
By example;
>>> a=[0,1,2,3,4,5,6]
>>> a
[0, 1, 2, 3, 4, 5, 6]
>>> a[2:5]
[2, 3, 4]
To my mind,
Thanks everyone for taking the time to offer some very insightful replies.
Learning a new language is so much more fun with a group of friendly and
helpful people around!
--
http://mail.python.org/mailman/listinfo/python-list
I am trying to invoke a binary that requires dll's in two places all of
which are included in the path env variable in windows. When running
this binary with popen it can not find either, passing env=os.environ
to open made no difference.
Anyone know what might cause this or how to work around thi
I have a set of methods which take args that I decorate twice,
def wrapped(func):
def wrap(*args, **kwargs):
try:
val = func(*args, **kwargs)
# some work
except BaseException as error:
log.exception(error)
return []
return wra
>> If you don't want to do that, you'd need to use introspection of a
>> remarkably hacky sort. If you want that, well, it'll take a mo.
>
> After some effort I'm pretty confident that the hacky way is impossible.
Hah, I fired it in PyCharm's debugger and spent a wack time myself, thanks
for the c
>Well, technically it's
>
>func.func_closure[0].cell_contents.__name__
>
>but of course you cannot know that for the general case.
Hah, I admit I lacked perseverance in looking at this in PyCharms debugger as I
missed
that.
Much appreciated!
jlc
--
http://mail.python.org/mailman/listinfo/python
I have a dict of lists. I need to create a list of 2 tuples, where each tuple
is a key from
the dict with one of the keys list items.
my_dict = {
'key_a': ['val_a', 'val_b'],
'key_b': ['val_c'],
'key_c': []
}
[(k, x) for k, v in my_dict.items() for x in v]
This works, but I need to t
> Yeah, it's remarkably easy too! Try this:
>
> [(k, x) for k, v in my_dict.items() for x in v or [None]]
>
> An empty list counts as false, so the 'or' will then take the second option,
> and iterate over the one-item list with > > None in it.
Right, I overlooked that!
Much appreciated,
jlc
--
I have some queries that utilize instr wrapped by substr but the old
version shipped in 2.7.5 doesn't have instr support.
Has anyone encountered this and utilized other existing functions
within the shipped 3.6.21 sqlite version to accomplish this?
Thanks,
jlc
--
http://mail.python.org/mailman/l
> Has anyone encountered this and utilized other existing functions
> within the shipped 3.6.21 sqlite version to accomplish this?
Sorry guys, forgot about create_function...
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I have a C++ module where I have a defined, working type. How would I make a
wrapper for this type to be able to be used in Python? I am familiar(-ish) with
the C-API for functions but I can't see concretely how one would include an
interface to a type.
Is it this? http://docs.python.org/r
I have what I think should be a relatively simple question for someone who
is knowledgeable about Python.
At the IDLE prompt, when I enter "b" > 99, it responds True. In fact, it
doesn't matter which number is entered here, "b" is always greater (e.g. "b"
> 1 == True; "b" > 10 == True, or "
Trying to robustly parse a string that will have key/value pairs separated
by three pipes, where each additional key/value (if more than one exists)
will be delineated by four more pipes.
string = 'key_1|||value_1key_2|||value_2'
regex = '((?:(?!\|\|\|).)+)(?:\|\|\|)((?:(?!\|\|\|).)+)(
> Regexes may be overkill here. A simple string split might be better:
Yup, and much more robust as I was looking for.
Thanks everyone!
jlc
--
http://mail.python.org/mailman/listinfo/python-list
I get a list of dicts as output from a source I need to then extract various
dicts
out of. I can easily extract the dict of choice based on it containing a key
with
a certain value using list comp but I was hoping to use dict comp so the output
was not contained within a list.
reduce(lambda x,y:
> {k: v for d in my_list if d['key'] == value for (k, v) in d.items()}
Ugh, had part of that backwards:) Nice!
> However, since you say that all dicts have a unique value for
> z['key'], you should never need to actually merge two dicts, correct?
> In that case, why not just use a plain for loop
>You could put the loop into a helper function, but if you are looping
>through the same my_list more than once why not build a lookup table
>
>my_dict = {d["key"]: d for d in my_list}
>
>and then find the required dict with
>
>my_dict[value]
I suppose, what I failed to clarify was that for each l
101 - 200 of 618 matches
Mail list logo