On 11/12/2023 16.16, Chris Green wrote:
Is there a way to abbreviate the following code somehow?
lv = {'dev':'bbb', 'input':'1', 'name':'Leisure volts'}
sv = {'dev':'bbb', 'input':'0', 'name':'Starter volts'}
la = {'dev':'bbb', 'input':'2', 'name':'Leisure Amps'}
sa = {'dev':
= {'dev':'bbb', 'input':'3', 'name':'Starter Amps'}
> >> bv = {'dev':'adc2', 'input':0, 'name':'BowProp Volts'}
> >>
> >> It's effectively a 'tab
7;3', 'name':'Starter Amps'}
>> bv = {'dev':'adc2', 'input':0, 'name':'BowProp Volts'}
>>
>> It's effectively a 'table' with columns named 'dev', 'input' and
>
tarter Amps'}
bv = {'dev':'adc2', 'input':0, 'name':'BowProp Volts'}
It's effectively a 'table' with columns named 'dev', 'input' and
'name' and I want to access the values of the table using the
On 2023-12-11, Chris Green via Python-list wrote:
> Is there a way to abbreviate the following code somehow?
>
> lv = {'dev':'bbb', 'input':'1', 'name':'Leisure volts'}
> sv = {'dev':'bbb', 'input':'0', 'name':'Starter volts'}
> la = {'dev':'bbb', 'input':'2', 'name':'Leisure Amps'}
>
= {'dev':'adc2', 'input':0, 'name':'BowProp Volts'}
>
> It's effectively a 'table' with columns named 'dev', 'input' and
> 'name' and I want to access the values of the table using the variable
Is there a way to abbreviate the following code somehow?
lv = {'dev':'bbb', 'input':'1', 'name':'Leisure volts'}
sv = {'dev':'bbb', 'input':'0', 'name':'Starter volts'}
la = {'dev':'bbb', 'input':'2', 'name':'Leisure Amps'}
sa = {'dev':'bbb', 'input':'3', 'name':'Starter Amps'}
at I know I am going to have to look at
> the documentation for dequeue when I want to use it. For lists, sets and
> dictionaries, I don't expect to look at the documentation and pop()
> seemed a good bet for what I wanted to do.
"What I expect" (aka 'dim/dusty recollecti
a problem, you're going to love using deques with their
'popping from the left' and 'popping from the right' concepts!
I think the difference here is that I know I am going to have to look at
the documentation for dequeue when I want to use it. For lists, sets and
dictiona
On 15/06/2021 01:36, Terry Reedy wrote:
On 6/14/2021 5:18 PM, BlindAnagram wrote:
I believe that consistency in how methods common to different types
work is useful since it adds to the coherence of the language as a
whole and avoids the need to remember special cases.
Each collection class
On 14Jun2021 09:39, BlindAnagram wrote:
>However, d.pop(key, [default]) returns the value (or the default) and
>consistency with other pops (a good thing in my view) would suggest
>that d.pop() could return a random value, which would serve my purpose
>when there is only one element.
If you do
On 6/14/2021 5:18 PM, BlindAnagram wrote:
I believe that consistency in how methods common to different types work
is useful since it adds to the coherence of the language as a whole and
avoids the need to remember special cases.
Each collection class *is* a special case, and pop has to be ad
On 15/06/2021 09.18, BlindAnagram wrote:
> On 14/06/2021 20:43, Chris Angelico wrote:
>> On Tue, Jun 15, 2021 at 5:41 AM BlindAnagram
...
> No it isn't hard to use popitem() but it evidently proved hard for me to
> remember that it was there.
If that's a problem, you're going to love using deques
my purpose when
there is only one element.
Is this actually important or are you just looking for a meaningless
"inconsistency"? Dictionaries are fundamentally different from lists.
Is it really that hard to use popitem?
No I am not looking for meaningless inconsistency - just the o
is only one element.
>
Is this actually important or are you just looking for a meaningless
"inconsistency"? Dictionaries are fundamentally different from lists.
Is it really that hard to use popitem?
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
we don't have d.pop() for
dictionaries?
My guess is because it's not generally useful to get an returns the value
arbitrary
value from a dict without its corresponding key. Hence the existence
of popitem().
However, d.pop(key, [default]) returns the value (or the default) and
c
The pop() method exists for five mainstream data items and shows a range
of different behaviours for each of them.
But, of the five, pop for dictionaries is the only one for which the
first parameter is required and this makes d.pop() for dictionaries an
error rather than doing something
o hold only one item?
>
> v = d.popitem()[1]
>
> > More importantly, is there a good reason why we don't have d.pop() for
> > dictionaries?
>
> My guess is because it's not generally useful to get an arbitrary
> value from a dict without its corresponding
On 14/06/21 4:19 am, BlindAnagram wrote:
Am I missing the obvious way to obtain the value (or the key) from a
dictionary that is known to hold only one item?
v = d.popitem()[1]
More importantly, is there a good reason why we don't have d.pop() for
dictionaries?
My guess is because it&
On Mon, 7 Dec 2020 at 23:35, Larry Martell wrote:
>
> On Mon, Dec 7, 2020 at 5:29 PM Marco Sulla
> wrote:
> >
> > You can return dictionaries that returns True if
> >
> > (a.items() & kwargs.items()) == kwargs.items()
> >
> > when `a` is one of
On 2020-12-07 22:06, Larry Martell wrote:
I have a class that has an object that contains a list of dicts. I
want to have a class method that takes a variable number of key/value
pairs and searches the list and returns the item that matches the
arguments.
If I know the key value pairs I can do s
On Mon, Dec 7, 2020 at 5:42 PM Matt Wheeler wrote:
>
> for item in self.data:
> if all(item[k] == v for k,v in kwargs.items()):
> return item
>
> Or
>
> return [item for item in self.data if all(item[k] == v for k,v in
> kwargs.items())]
>
> to return all matches
>
> Beware though tha
for item in self.data:
if all(item[k] == v for k,v in kwargs.items()):
return item
Or
return [item for item in self.data if all(item[k] == v for k,v in
kwargs.items())]
to return all matches
Beware though that either of these will be slow if your list of dicts is large.
If the list
On Mon, Dec 7, 2020 at 5:29 PM Marco Sulla wrote:
>
> You can return dictionaries that returns True if
>
> (a.items() & kwargs.items()) == kwargs.items()
>
> when `a` is one of your dicts.
But what is passed in kwargs will not necessarily have values for all
of the keys an
You can return dictionaries that returns True if
(a.items() & kwargs.items()) == kwargs.items()
when `a` is one of your dicts.
--
https://mail.python.org/mailman/listinfo/python-list
I have a class that has an object that contains a list of dicts. I
want to have a class method that takes a variable number of key/value
pairs and searches the list and returns the item that matches the
arguments.
If I know the key value pairs I can do something like this:
instance = next(item fo
If I may, a couple of items of list-etiquette (polite behavior), as I
understand them:
1 please reply to the list (cf only myself) because @Mats (who responded
earlier) and others on this list are much smarter than me, and might be
able to help you more quickly
2 top-posting seems to take the fo
On 10/18/20 2:09 PM, Shaozhong SHI wrote:
> Even worse is that, in some cases, an addition called serviceRatings as a
> key occur with new data unexpectedly.
>
> How to produce a robust Python/Panda script to coping with all these?
>
> Regards,
>
> David
>
> u'historicRatings': [{u'overall': {u
On 19/10/2020 09:09, Shaozhong SHI wrote:
Even worse is that, in some cases, an addition called serviceRatings as a
key occur with new data unexpectedly.
"Even worse" than what?
Do you need to keep a list of acceptable/applicable/available keys?
(and reject or deal with others in some alternat
Even worse is that, in some cases, an addition called serviceRatings as a
key occur with new data unexpectedly.
How to produce a robust Python/Panda script to coping with all these?
Regards,
David
u'historicRatings': [{u'overall': {u'keyQuestionRatings': [{u'name':
u'Safe', u'rating': u'Require
you can use the following: (change the matrices as it suits your app):
import numpy as np
def set_params(w, b):
params = {"w0": w[0], "w1": w[1] , "w2": w[2], "w3": w[3], "w4":
w[4], "b": b}
return params
w = np.random.randn((5))
b = 1
params = set_params(w, b)
for i in range(5)
Good morning everyone
I would like to know if i can to create a dictionary with two matrices, where
every element of the first matrix corresponds to dictionary's keys and the
elements of the second matrix will be the values every key.
thanks
--
https://mail.python.org/mailman/listinfo/python-lis
On Thu, 19 Mar 2020 at 16:46, Peter J. Holzer wrote:
> This is similar to algebraic expressions: Have you ever tried to read a
> mathematical paper from before the time the current notation (which we
> Long, convoluted
> sentences instead of what can now be written as a short formula.
...yes, and
On 2020-03-19 15:17, Musbur wrote:
Hello,
either it's me or everybody else who's missing the point. I understand
the OP's proposal like this:
dict[set] == {k: dict[k] for k in set}
list[iterable] == [list[i] for i in iterable]
Am I right?
"Iterable" is too broad because it includes tuples an
On 19/03/2020 14:47, Peter J. Holzer wrote:
On 2020-03-19 14:24:35 +, Rhodri James wrote:
On 19/03/2020 13:00, Peter J. Holzer wrote:
It's more compact, especially, if "d" isn't a one-character variable,
but an expression:
fname, lname = db[people].employee.object.get(pk=1234)[['firs
On Fri, Mar 20, 2020 at 2:46 AM Peter J. Holzer wrote:
> > A good language has a small core and extensibility via
> > libraries.
>
> This would actually be a feature of the (standard) library.
I think the line kinda blurs here. This would be a feature of a core
data type, and in CPython, it would
For dictionaries it'd even be more useful:
d = {
'first_name': 'Frances',
'last_name': 'Allen',
'email': 'fal...@ibm.com'
}
fname, lname = d[['first_name', 'last_name']]
Why no
On Fri, Mar 20, 2020 at 2:37 AM Terry Reedy wrote:
>
> On 3/18/2020 10:28 PM, Santiago Basulto wrote:
>
> > For dictionaries it'd even be more useful:
> > d = {
> > 'first_name': 'Frances',
> > &
On 2020-03-19 08:05:18 -0700, Dan Stromberg wrote:
> On Thu, Mar 19, 2020 at 7:47 AM Peter J. Holzer wrote:
> > On 2020-03-19 14:24:35 +, Rhodri James wrote:
> > > On 19/03/2020 13:00, Peter J. Holzer wrote:
> > > > It's more compact, especially, if "d" isn't a one-character variable,
> > > >
On 03/19/2020 02:09 AM, Terry Reedy wrote:
On 3/18/2020 10:28 PM, Santiago Basulto wrote:
For dictionaries it'd even be more useful:
d = {
'first_name': 'Frances',
'last_name': 'Allen',
'email':
On 3/18/2020 10:28 PM, Santiago Basulto wrote:
For dictionaries it'd even be more useful:
d = {
'first_name': 'Frances',
'last_name': 'Allen',
'email': 'fal...@ibm.com'
}
fname, lname
Hello,
either it's me or everybody else who's missing the point. I understand
the OP's proposal like this:
dict[set] == {k: dict[k] for k in set}
list[iterable] == [list[i] for i in iterable]
Am I right?
--
https://mail.python.org/mailman/listinfo/python-list
Py? I think multi indexing
> alone would be huge addition. A few examples:
>
> For lists and tuples:
> >>> l = ['a', 'b', 'c']
> >>> l[[0, -1]]
> ['a', 'c']
>
> For dictionaries it
On Thu, Mar 19, 2020 at 7:47 AM Peter J. Holzer wrote:
> On 2020-03-19 14:24:35 +, Rhodri James wrote:
> > On 19/03/2020 13:00, Peter J. Holzer wrote:
> > > It's more compact, especially, if "d" isn't a one-character variable,
> > > but an expression:
> > >
> > > fname, lname =
> db[peop
On 2020-03-19 14:24:35 +, Rhodri James wrote:
> On 19/03/2020 13:00, Peter J. Holzer wrote:
> > It's more compact, especially, if "d" isn't a one-character variable,
> > but an expression:
> >
> > fname, lname = db[people].employee.object.get(pk=1234)[['first_name',
> > 'last_name']]
> >
On 19/03/2020 13:00, Peter J. Holzer wrote:
On 2020-03-19 18:22:34 +1300, DL Neil via Python-list wrote:
On 19/03/20 3:28 PM, Santiago Basulto wrote:
myself missing A LOT features from NumPy, like fancy indexing or
boolean arrays.
So, has it ever been considered to bake into Python's builtin li
t and
> > dictionary types functionality inspired by NumPy? I think multi indexing
> > alone would be huge addition. A few examples:
> > For lists and tuples:
> > >>> l = ['a', 'b', 'c']
> > >>> l[[0, -1]]
&g
be huge addition. A few examples:
For lists and tuples:
>>> l = ['a', 'b', 'c']
>>> l[[0, -1]]
['a', 'c']
For dictionaries it'd even be more useful:
d = {
'first_name': 'Frances&
lists and tuples:
>>> l = ['a', 'b', 'c']
>>> l[[0, -1]]
['a', 'c']
For dictionaries it'd even be more useful:
d = {
'first_name': 'Frances',
'last_name': 'Allen
How do I connect it with my dictionary
On Thu, Jan 30, 2020, 7:03 AM Tim Chase
wrote:
> On 2020-01-30 06:44, Souvik Dutta wrote:
> > Hey I was thinking how I can save a dictionary in python(obviously)
> > so that the script is rerun it automatically loads the dictionary.
>
> This is almost exact
On 2020-01-30 01:51, Michael Torrie wrote:
On 1/29/20 6:14 PM, Souvik Dutta wrote:
Hey I was thinking how I can save a dictionary in python(obviously) so that
the script is rerun it automatically loads the dictionary.
You could use the pickle module for that. See the python.org
documentation o
Thank you all.
On Thu, Jan 30, 2020, 7:25 AM DL Neil via Python-list <
python-list@python.org> wrote:
> On 30/01/20 2:14 PM, Souvik Dutta wrote:
> > Hey I was thinking how I can save a dictionary in python(obviously) so
> that
> > the script is rerun it automatically loads the dictionary.
>
>
> P
On 2020-01-30 06:44, Souvik Dutta wrote:
> Hey I was thinking how I can save a dictionary in python(obviously)
> so that the script is rerun it automatically loads the dictionary.
This is almost exactly what the "dbm" (nee "anydbm") module does, but
persisting the dictionary out to the disk:
im
On 30/01/20 2:14 PM, Souvik Dutta wrote:
Hey I was thinking how I can save a dictionary in python(obviously) so that
the script is rerun it automatically loads the dictionary.
Perhaps a YAML or JSON file (which follow a very similar format and
structure to Python dicts), or a 'NoSQL' database
On 1/29/20 6:14 PM, Souvik Dutta wrote:
> Hey I was thinking how I can save a dictionary in python(obviously) so that
> the script is rerun it automatically loads the dictionary.
You could use the pickle module for that. See the python.org
documentation on pickle.
Alternatively you could use a js
Hey I was thinking how I can save a dictionary in python(obviously) so that
the script is rerun it automatically loads the dictionary.
--
https://mail.python.org/mailman/listinfo/python-list
al Message-
From: Python-list
[mailto:python-list-bounces+david.raymond=tomtom@python.org] On Behalf Of
har...@moonshots.co.in
Sent: Thursday, August 30, 2018 4:31 AM
To: python-list@python.org
Subject: Re: How to sort over dictionaries
> > sort = sorted(results, key=lambda res:ite
> > sort = sorted(results, key=lambda res:itemgetter('date'))
> > print(sort)
> >
> >
> > I have tried the above code peter but it was showing error like
> > TypeError: '<' not supported between instances of 'operator.itemgetter'
> > and 'operator.itemgetter'
>
> lambda res: itemgetter('
har...@moonshots.co.in wrote:
> sort = sorted(results, key=lambda res:itemgetter('date'))
> print(sort)
>
>
> I have tried the above code peter but it was showing error like
> TypeError: '<' not supported between instances of 'operator.itemgetter'
> and 'operator.itemgetter'
lambda res: it
>
> > On Wednesday, August 29, 2018 at 11:20:26 AM UTC+5:30, John Ladasky wrote:
> >> The top-level object you are showing is a list [], not a dictionary {}.
> >> It has dictionaries inside of it though. Do you want to sort the list?
> >>
> >> Pyt
Well, that's a list of... somethings. So I'm assuming you mean sort a list of
dictionaries?
foo.sort(key = lambda x: time.strptime(x["date"], "%d-%m-%Y %H:%M"))
with , reverse = True in the sort if you want it sorted in reverse
-Original Message-
Fro
[,
https://getbootstrap.com/', 'author': 'Hari', 'date': '15-08-2018 15:15',
'headline': 'latest news'}>, , https://www.deps.co/blog/google-cloud-platform-good-bad-ugly/', 'author':
'Harish', 'headline': 'Google Cloud Platform – The Good, Bad, and Ugly',
'date': '16-08-2018 08:15'}>, , ,
http:
har...@moonshots.co.in wrote:
> On Wednesday, August 29, 2018 at 11:20:26 AM UTC+5:30, John Ladasky wrote:
>> The top-level object you are showing is a list [], not a dictionary {}.
>> It has dictionaries inside of it though. Do you want to sort the list?
>>
>>
On Wednesday, August 29, 2018 at 11:20:26 AM UTC+5:30, John Ladasky wrote:
> The top-level object you are showing is a list [], not a dictionary {}. It
> has dictionaries inside of it though. Do you want to sort the list?
>
> Python's sorted() function returns a sorted c
The top-level object you are showing is a list [], not a dictionary {}. It has
dictionaries inside of it though. Do you want to sort the list?
Python's sorted() function returns a sorted copy of a sequence. Sorted() has
an optional argument called "key". Key accepts a second
Hi everyone !
I released a new version (0.2.5) of **Scalpl** which is available on
PyPI :)
https://github.com/ducdetronquito/scalpl
You can install it via pip:
pip3 install scalpl
Scalpl is a lightweight wrapper that helps you to operate on nested
dictionaries through the built-in dict
On Thu, 1 Jun 2017 10:29 am, David D wrote:
Is there a way of performing this
where the key will update so that is continues to work sequentially?
It sounds like you don't want a dictionary at all, you want a list.
You can use the index() method to find the current "key" of an entry.
>>> peop
On Thu, 1 Jun 2017 10:29 am, David D wrote:
> I have a dictionary with a 10 people, the key being a number (0-10) and the
> value being the people's name. I am in the processing of Insert, Adding and
> deleting from the dictionary. All seems well until I delete a person and add
> a new one. The
Learning about dictionaries for a database possibly in the future.
On Wednesday, May 31, 2017 at 8:58:39 PM UTC-4, MRAB wrote:
> On 2017-06-01 01:29, David D wrote:
> > I have a dictionary with a 10 people, the key being a number (0-10) and the
> > value being the people'
On 2017-06-01 01:29, David D wrote:
I have a dictionary with a 10 people, the key being a number (0-10) and the
value being the people's name. I am in the processing of Insert, Adding and
deleting from the dictionary. All seems well until I delete a person and add a
new one. The numbers (ke
I have a dictionary with a 10 people, the key being a number (0-10) and the
value being the people's name. I am in the processing of Insert, Adding and
deleting from the dictionary. All seems well until I delete a person and add a
new one. The numbers (keys) do not change and so I am getting
/ducdetronquito/scalpl
It is a lightweight wrapper that helps you to operate on nested
dictionaries through the built-in dict API, by using dot-separated
string keys.
You might find it useful when working with document-oriented database
queries, REST APIs, configuration files, etc...
It's
On Fri, 19 Jun 2015 03:57 am, Gilcan Machado wrote:
> Hi,
>
> I'm trying to write a list of dictionaries like:
>
> people = (
> {'name':'john', 'age':12} ,
> {'name':'kacey', 'age':18}
On 06/18/2015 10:57 AM, Gilcan Machado wrote:
Hi,
I'm trying to write a list of dictionaries like:
people = (
{'name':'john', 'age':12} ,
{'name':'kacey', 'age':18}
)
I've thought the code below wou
On 2015-06-18 18:57, Gilcan Machado wrote:
Hi,
I'm trying to write a list of dictionaries like:
people = (
{'name':'john', 'age':12} ,
{'name':'kacey', 'age':18}
)
That's not a list; it's
Hi,
I'm trying to write a list of dictionaries like:
people = (
{'name':'john', 'age':12} ,
{'name':'kacey', 'age':18}
)
I've thought the code below would do the task.
But it doesn't work.
And if
On 2015-05-06 20:22, Tim Chase wrote:
> As ChrisA posted earlier, you have to use Excel's Import
> functionality (there are several ways to get this wizard, but not
> all ways of opening a .csv trigger the wizard), then specify those
> particular columns as "Text" rather than "General"
Sorry, it w
On 2015-05-06, Denis McMahon wrote:
> You need to format your CSV date into a date format that Excel
> understands when it imports it.
>
> First thing to try would be to export some dates from excel as CSV and
> see what format excel puts them in.
Beware of assuming that Excel can import its ow
On 2015-05-06 23:31, Denis McMahon wrote:
> On Tue, 05 May 2015 22:32:28 -0700, Kashif Rana wrote:
> > thanks for the feedback. I think its problem with excel itself,
> > showing wrong value. Because when I opened the csv file in text
> > editor, I can see correct value but opening in excel showing
On Tue, 05 May 2015 22:32:28 -0700, Kashif Rana wrote:
> thanks for the feedback. I think its problem with excel itself, showing
> wrong value. Because when I opened the csv file in text editor, I can
> see correct value but opening in excel showing wrong value. What I can
> do to see correct in e
On 2015-05-06 12:27, Ian Kelly wrote:
> On Wed, May 6, 2015 at 12:22 PM, Tim Chase
> wrote:
> > On 2015-05-06 19:08, MRAB wrote:
> >> You could tell it to quote any value that's not a number:
> >>
> >> w = csv.DictWriter(f, pol_keys,
> >> quoting=csv.QUOTE_NONNUMERIC)
> >>
> >> It looks like
On Wed, May 6, 2015 at 12:22 PM, Tim Chase
wrote:
> On 2015-05-06 19:08, MRAB wrote:
>> You could tell it to quote any value that's not a number:
>>
>> w = csv.DictWriter(f, pol_keys,
>> quoting=csv.QUOTE_NONNUMERIC)
>>
>> It looks like all of the values you have are strings, so they'll
>> a
On 2015-05-06 19:08, MRAB wrote:
> You could tell it to quote any value that's not a number:
>
> w = csv.DictWriter(f, pol_keys,
> quoting=csv.QUOTE_NONNUMERIC)
>
> It looks like all of the values you have are strings, so they'll
> all be quoted.
>
> I would hope that Excel will then treat
t would be
stupid if it didn't! :-)
On Tuesday, May 5, 2015 at 9:09:40 PM UTC+4, Kashif Rana wrote:
Hello Experts
When I am writing list of dictionaries to CSV file, the key 'schedule' has
value 'Mar 2012' becomes Mar-12. I really do not have clue why thats happening.
B
Op Wednesday 6 May 2015 07:32 CEST schreef Kashif Rana:
> thanks for the feedback. I think its problem with excel itself,
> showing wrong value. Because when I opened the csv file in text
> editor, I can see correct value but opening in excel showing wrong
> value. What I can do to see correct in
On Wed, May 6, 2015 at 3:32 PM, Kashif Rana wrote:
> thanks for the feedback. I think its problem with excel itself, showing wrong
> value. Because when I opened the csv file in text editor, I can see correct
> value but opening in excel showing wrong value. What I can do to see correct
> in ex
at 9:09:40 PM UTC+4, Kashif Rana wrote:
> Hello Experts
>
> When I am writing list of dictionaries to CSV file, the key 'schedule' has
> value 'Mar 2012' becomes Mar-12. I really do not have clue why thats
> happening. Below is the code.
>
> dic
On 2015-05-05 10:09, Kashif Rana wrote:
> When I am writing list of dictionaries to CSV file, the key
> 'schedule' has value 'Mar 2012' becomes Mar-12.
How are you making this determination? Are you looking at the raw
CSV output, or are you looking at the CSV file load
On 2015-05-05 14:25, Skip Montanaro wrote:
> More likely, viewing the CSV file in Excel, Gnumeric, or some other
> spreadsheet which interprets some inputs as dates and formats them
> according to its default rules. Skip
This is depressingly common, and I've even received CSV and plain text
data
Op Tuesday 5 May 2015 19:09 CEST schreef Kashif Rana:
> When I am writing list of dictionaries to CSV file, the key
> 'schedule' has value 'Mar 2012' becomes Mar-12. I really do not have
> clue why thats happening. Below is the code.
>
> dic_1 = {'action
On Tue, May 5, 2015 at 1:11 PM, MRAB wrote:
> I'm assuming that you're reading the CSV file in a text editor, not
> some other application that might be trying to be "clever" by
> "interpreting" what it thinks looks a date as a date and then
> displaying it differently...
More likely, viewing the
On 2015-05-05 18:09, Kashif Rana wrote:
Hello Experts
When I am writing list of dictionaries to CSV file, the key 'schedule' has
value 'Mar 2012' becomes Mar-12. I really do not have clue why thats happening.
Below is the code.
dic_1 = {'action': 'permit
Hello Experts
When I am writing list of dictionaries to CSV file, the key 'schedule' has
value 'Mar 2012' becomes Mar-12. I really do not have clue why thats happening.
Below is the code.
dic_1 = {'action': 'permit',
'dst-address': '
Charles Heizer wrote:
> On Monday, March 2, 2015 at 11:23:37 AM UTC-8, Peter Otten wrote:
>> Charles Heizer wrote:
>>
>> > Never mind, the light bulb finally went off. :-\
>> >
>> > sortedlist = sorted(mylist , key=lambda elem: "%s %s" % ( elem['name'],
>> > (".".join([i.zfill(5) for i in elem['
On Tuesday, 3 March 2015 16:09:31 UTC, Chris Angelico wrote:
> On Wed, Mar 4, 2015 at 2:56 AM, Charles Heizer wrote:
> >> Personally, I prefer to not use a lambda:
> >>
> >> def name_version(elem):
> >> return elem['name'], LooseVersion(elem['version'])
> >>
> >> result = sorted(mylist, key=na
On Wed, Mar 4, 2015 at 2:56 AM, Charles Heizer wrote:
>> Personally, I prefer to not use a lambda:
>>
>> def name_version(elem):
>> return elem['name'], LooseVersion(elem['version'])
>>
>> result = sorted(mylist, key=name_version, reverse=True)
>
> Peter, thank you. Me being new to Python why
On Monday, March 2, 2015 at 11:23:37 AM UTC-8, Peter Otten wrote:
> Charles Heizer wrote:
>
> > Never mind, the light bulb finally went off. :-\
> >
> > sortedlist = sorted(mylist , key=lambda elem: "%s %s" % ( elem['name'],
> > (".".join([i.zfill(5) for i in elem['version'].split(".")])) ),
> >
On Wed, Mar 4, 2015 at 1:45 AM, Jason Friedman wrote:
> I appreciate
> how Python makes my job easier by doing much of my work for me. A
> colleague yesterday asked how I guaranteed my temporary file names
> would not collide with another file, and my answer was I don't have to
> worry about it,
On Tue, Mar 3, 2015 at 12:07 AM, Chris Angelico wrote:
> Heh, I think that mght be a bit abusive :) I'm not sure that
> you want to depend on the version numbers fitting inside the rules for
> IP addresses, especially given that the example has a component of
> "2214".
>
Indeed, I was mi
Charles Heizer wrote:
> Hello,
> I'm new to python and I'm trying to find the right way to solve this issue
> I have.
>
> I'm trying to sort this list by name and then by version numbers. The
> problem I'm having is that I can not get the version numbers sorted with
> the highest at the top or so
1 - 100 of 1338 matches
Mail list logo