I'm new to Python, and using Google App Engine, which is currently running only Python 2.5. Are there any built-in ways of doing an ordered dictionary, or do I have to implement something custom?
...
Hi All
Im trying to get an enumberable collection from a dictionary held array.
Or should I say, I'm trying to write an extension method for my dictionary objects which store arrays to return an IEnumerable item when the result is null.
Im using dictionarys to store array datasets (there are speed reasons for this), which I extract at ...
Is there a good way of marshalling a Dictionary<string, string> over COM interop?
Ideas so far include tokenising each KeyPair to an array of strings which can be marshalled as a SafeArray, or having two string arrays containing keys and values.
Neither seems particularly satisfactory. Any ideas?
...
I want to do something like this:
parsetable = {
# ...
declarations: {
token: 3 for token in [_id, _if, _while, _lbrace, _println]
}.update({_variable: 2}),
#...
}
However this doesn't work because update doesn't return a...
For example I have a class named Temp then I assigned values to it using an IList<Temp>.
After populating the IList<Temp> I created a dictionary and assign an int key to each object.
My question is that how do I remove from IList and dictionary the temp_value with the name b and a with a key value of "2"?
class Temp
{
public string ...
I want to compare the contents of two Dictionary<string, string> instances regardless of the order of the items they contain. SequenceEquals also compares the order, so I first order the dictionaries by key and then call SequenceEquals.
Is there a method that I can use instead of SequenceEquals that will only compare the contents?
I...
abc = {}
abc[int: anotherint]
Then the error came up. TypeError: unhashable type? Why I received this?
I've tried str()
...
Hello,
I wondered if anyone could point me in the direction of a English dictionary download (free).
I do NOT want:
Spelling check dictionaries
Links to websites that don't provide me with an actual dictionary
Dictionaries in some weird format
I want something like a notepad or SQL script that has the following simple format:
Hat...
I am writing code that will search twitter for key words and store them in a python dictionary:
base_url = 'http://search.twitter.com/search.json?rpp=100&q=4sq.com/'
query = '7bOHRP'
url_string = base_url + query
logging.info("url string = " + url_string)
json_text = fetch(url_string)
...
Related to a previous question, I'm trying to do replacements over a number of large CSV files.
The column order (and contents) change between files, but for each file there are about 10 columns that I want and can identify by the column header names. I also have 1-2 dictionaries for each column I want. So for the columns I want, I want...
I'm programming a microcontroller in C and as part of it want to display certain letters on a 7 segment display. Each letter has a corresponding number that makes the 7 segment display show the letter. There's no real pattern to it cause the number is just made by adding up the bits on the 7 segment display that are needed to show the le...
I have a dictionary:
{'key1':1, 'key2':2, 'key3':3}
I need to pass a sub-set of that dictionary to third-party code. It only wants a dictionary containing keys ['key1', 'key2', 'key99'] and if it gets another key (eg 'key3'), it explodes in a nasty mess. The code in question is out of my control so I'm left in a position where I have ...
Beginner programmer here! I need to write a simple phone book application. My program should be able to add names and phone numbers to a database. I should use a dictionary to store the information. If the user's input is empty, my program should stop, otherwise it should keep on asking inputs.
Honestly I am lost here. I need help.
...
I want to create a polymorphic structure that can be created on the fly with minimum typing effort and be very readable. For example:
a.b = 1
a.c.d = 2
a.c.e = 3
a.f.g.a.b.c.d = cucu
a.aaa = bau
I do not want to create an intermediate container such as:
a.c = subobject()
a.c.d = 2
a.c.e = 3
My question is similar to this one:
http...
Hi, I've got a problem , and do not know how to code in python.
I've got a list[10, 10, 10, 20, 20, 20, 30]
I want it be in a dictionary like this
{"10": 1, "20": 3, "30" : 1}
How could I achieve this?
...
Hi
I have a python dictionary stored in a file which I need to access from a c++ program. What is the best way of doing this?
Thanks
...
Hi all,
I am looking forward to serialize a Dictionary in order to save some of it's information, more precisely it's Key and one of it's Value, into Silverlight Isolated storage. I have read many question talking about the same subject on these boards, but none were explaining what I was trying to do, or at least not in a way I could u...
I have problem when trying to convert dictionary to list.
Example if I have dictionary with template string as key and string as value. Then i wish to convert dictionary key to list collection as string.
Dictionary<string, string> dicNumber = new Dictionary<string, string>();
List<string> listNumber = new List<string>();
dicNumber.Add...
Hello,
Is there an easier way to do this in Python (2.7)?: Note: This isn't anything fancy, like putting all local variables into a dictionary. Just the ones I specify in a list.
apple = 1
banana = 'f'
carrot = 3
fruitdict = {}
# I want to set the key equal to variable name, and value equal to variable value
# is there a more Pythonic...
I've got a list of student/assignment pairs coming in to my application via flat file into a List object and I'd like to validate those assignment names against a list of assignments I have to see which student has done what assignment (if any).
So - I have a list of students, a list of student/assignment pairs, and a list of assignment...