473,322 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Hashtables in pyhton ...

Hi,

are there predefinded chances to use hashtables in python? How can I use
Hashtable in python? Or do I have to implement this on my own?

Thanks
Mar 9 '06 #1
6 1879
Konrad Mühler wrote:
Hi,

are there predefinded chances to use hashtables in python? How can I use
Hashtable in python? Or do I have to implement this on my own?


a_hash_is_a_dict = {'key':'value'}
a_hash_is_a_dict['key2'] = 'value 2'
a_hash_is_a_dict['key']

'value'

--

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science

Phone: +45 66 11 84 94
Mobile: +45 29 93 42 96
Mar 9 '06 #2
Konrad Mühler wrote:
Hi,

are there predefinded chances to use hashtables in python? How can I use
Hashtable in python? Or do I have to implement this on my own?

Thanks


Take a look at a python dictionary. keys in dictionaries are hashed and
lookups are very efficient.

-Larry Bates
Mar 9 '06 #3
Konrad Mühler wrote:
are there predefinded chances to use hashtables in python? How can I use
Hashtable in python? Or do I have to implement this on my own?


is this what you want?

http://docs.python.org/tut/node7.htm...00000000000000

</F>

Mar 9 '06 #4
Hashtables (dictonaries) and ArrayLists(lists) are integral parts of
modern languages (for example: Python, Ruby, OCaml, D). They are
builtin data types unlike say, Java or C++, where they are added to the
library as an afterthought.

Mar 9 '06 #5
Konrad Mühler wrote:
Hi,

are there predefinded chances to use hashtables in python? How can I use
Hashtable in python? Or do I have to implement this on my own?

Thanks

A Java Hashtable/Hashmap is equivalent to a Python dictionary, which is
a builtin objects (and not a second-class citizen in some distant, dark,
cold library full of Evil Things ©). You can access it either via the
regular constructor `dict()` or via the syntaxical shorcut

{ key1: val1, key2: val2, key3: val3}
Mar 10 '06 #6
Max M wrote:
>>> a_hash_is_a_dict = {'key':'value'}
>>> a_hash_is_a_dict['key2'] = 'value 2'
>>> a_hash_is_a_dict['key']

'value'


Thank you very much.
This is I was looking for :-)
Mar 10 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: | last post by:
Hi grp, I new to this grp and python too. i have started writing few python scripts myself. now i am planning to write a bear minimum email client in pyhton. i found the smtp module of python...
6
by: Michael Schollmeyer | last post by:
Hello, The following code writes the text string: Uri uri1 = new Uri("http://www.here.net/aplace?param=one"); Uri uri2 = new Uri("http://www.here.net/aplace?param=two"); int h1 =...
13
by: Anders Borum | last post by:
Hello! Now that generics are introduces with the next version of C#, I was wondering what kind of performance gains we're going to see, when switching from e.g. the general hashtable to a...
4
by: Anders Borum | last post by:
Hello! I have a list of singleton classes (model managers) that store objects internally using hashtables. Each of these classes use a single hashtable to store e.g. users, pages, elements and...
1
by: Curtis | last post by:
Does anyone know the proper method to save information to embedded hashtables. I am trying to save parent/child information to hashtables but I am not getting the correct results I have made a...
2
by: PAzevedo | last post by:
I have this Hashtable of Hashtables, and I'm accessing this object from multiple threads, now the Hashtable object is thread safe for reading, but not for writing, so I lock the object every time I...
5
by: jeff | last post by:
could somebody explain to me how to install (or compile) GD for linux, so that it works in pyhton?
0
by: soussou97 | last post by:
Hi; I would like to automatically delivery, I seek a script in python which will be excecute from a Windows station to allows via sftp: 1- to connect to a Linux server for storing of the files...
7
by: Kamran Shafi | last post by:
Hi, I am creating an arraylist (say masterArrayList) of hashtables, where each hashtable (say table) is of the format key=string, value = arraylist of strings (say existing_strings). In a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.