dictionary

convert string to dict using list comprehension in python

I have came across this problem a few times and can't seem to figure out a simple solution. Say I have a string string = "a=0 b=1 c=3" I want to convert that into a dictionary with a, b and c being the key and 0, 1, and 3 being their respective values (converted to int). Obviously I can do this: list = string.split() dic ...

english dictionary API with phonetics and accents?

I'm not only a programmer, but an amateur poet, and I'd like to build some custom rhyming dictionary programs. I want to be able to specify what kinds of rhymes and follow patterns on the rhythm of words (iambic vs trochaic) as well as the sound. So, is there an API, dictionary DB essentially for english that has the spelling of words ...

Embed Dictionary into vb .net application

I want to embed a dictionary.txt which my program uses a streamreader object to parse. I tried to add it to resources but then the streamreader had an error. How can it be properly done? Thanks ...

sort dictionary by another dictionary

I've been having a problem with making sorted lists from dictionaries. I have this list list = [ d = {'file_name':'thisfile.flt', 'item_name':'box', 'item_height':'8.7', 'item_width':'10.5', 'item_depth':'2.2', 'texture_file': 'red.jpg'}, d = {'file_name':'thatfile.flt', 'item_name':'teapot', 'item_height':'6.0', 'item_width':'...

Efficient way to get a range of Keys from Dictionary

I have a Dictionary that for most operations I just need to retrieve a single entry by key, but for a few operations I will need to work with the entries associated with a range of keys. The way that occurs to me to do this is to use GetKeys and a FindAll that will match the range I am interested in, but was wondering if someone could su...

English dictionary SQL dump?

I'm looking for an open source, full english dictionary, that includes the type of word (i.e.: adjective, past tense, etc.) in some sort of database format, either SQL or something that could be easily parsed and turned into sql. Any idea where I could find such a thing? ...

Locking a custom dictionary

Good day pythonians, I want to make a custom dictionary with two main features: All keys are declared on creation It is impossible to add new keys or modify current ones (values are still modifiable) Right now code is this: class pick(dict): """This will make delicious toffee when finished""" def __init__(self, *args): ...

Best way to grab an array of dictionaries from a plist and create sections based on the values for a key.

I have a plist that contains an array with a collection of dictionaries. The dictionaries in the array are used to create a fairly complex tableview with 2 images and 2 lines of text in each cell. I am wanting to create sections in the tableview based on the first letter for the value corresponding to the "MainText" key. Here is the p...

Select Rows from a DataSet using LINQ, where the list of RowsID's are in a List<T>

First I have to say, that I am a newby using LINQ. Actually I never used before, but I am having a task where I need to filter a DataTable, using values that will come from a List. So I will like to know if it's possible in LINQ to query on a Datatable using values in the List as Filter values. Some one can give me some hint's Thank you...

Best way to cache store a dictionary in c#

I am writing out a navigation structure of categories. Each category has an ID, that is located in a 3rd party search tool. At either app start, or at various intervals, I need to get the caetegories and their id's, and store them in a dictionary (or some other way) so that I can access them for link rewriting from id to name. ...

Find Duplicate Values in a dictonary

Hi all, I'm writing a small program to find duplicate files I iterate through each file in a directory then i load the file path and the md5hash of that file into a dictionary ( file path being the key) I next want to walk through each value in the dictionary to see if any values match then display the two+ keys in a display window ...

Something like Dictionary but can store more than one value?

Possible Duplicate: Multi value Dictionary I just need to store 2 value. How can I do that? ...

How to get the list of key in dictionary c#

I never gotten any code I tried to work?. I want to key and not value(yet). Using another array prove to be much work as I use remove also. ...

Store a generic dictionary in an asp.net profile?

Hi, Is there any way of storing a generic dictionary object in an asp.net profile? I have tried using this but it still doesn't like it: http://weblogs.asp.net/pwelter34/default.aspx Thanks, Nick ...

Python and dictionary like object

I currently toying with Python 3.1 and I need a deep update function for dictionaries (a function that willl recursively update child dictionaries that are inside a parent dictionary). But I think, in the future, my function could have to deal with objects that behave like dictionaries but aren't. And furthermore isinstance and type are...

remove duplicates from nested dictionaries in list

Hello, quick and very basic newbie question. If i have list of dictionaries looking like this: L = [] L.append({"value1": value1, "value2": value2, "value3": value3, "value4": value4}) Let's say there exists multiple entries where value3 and value4 are identical to other nested dictionaries. How can i quick and easy find and remove ...

What's the optimal way to compute a hashcode for a set of points?

I'm looking for the optimal way to compute a hashcode for a set of bi-dimensional points (so that I can store polygons in a hashtable). There are some obvious ways to do that, such as concatenating all the points coordinates in a string and its hashcode, but this would be very slow. On the other end of the speed/collision spectrum, I c...

python: How do I check that multiple keys are in a dict in one go?

I want to do something like: foo = {'foo':1,'zip':2,'zam':3,'bar':4} if ("foo","bar") in foo: #do stuff I'm not sure if its possible but would like to know. :-) ...

how to bind datasource to List<Dictionary<string, string>> ?

Hello, I have a class that stores a list of dictionary entries. I want bind that to a datasource for gridview from codebehind. Code for dictionary type of , representing ErrorMessage and failed field. public partial class FailedFields { private Dictionary<string, string> Code_Error = new Dictionary<string, string>(); public voi...

python: Overhead to using classes instead of dictionaries?

First, I'd like to point out that I know OOP concepts and understand the differences between dictionaries and classes. My question is about what makes sense design wise in this case: I am designing a webapp in python and I have to represent something like a book object. Books have chapters and chapters have titles and content. For simpl...