Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83408
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <davea@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.028 |
| X-Spam-Evidence | '*H*': 0.94; '*S*': 0.00; 'python,': 0.02; 'table.': 0.07; 'question?': 0.09; '"list': 0.16; 'did.': 0.16; 'element,': 0.16; 'fetch': 0.16; 'wrote:': 0.18; 'python?': 0.22; 'header :User-Agent:1': 0.23; 'error': 0.23; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'skip:p 30': 0.29; 'am,': 0.29; 'array': 0.29; 'correctly.': 0.31; 'table': 0.34; 'but': 0.35; 'add': 0.35; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'called': 0.40; 'how': 0.40; 'tell': 0.60; 'email addr:gmail.com': 0.63; 'real': 0.63; 'received:74.208': 0.68; 'dict,': 0.84; 'received:74.208.4.194': 0.84 |
| Date | Fri, 09 Jan 2015 02:30:53 -0500 |
| From | Dave Angel <davea@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Array of hash table |
| References | <05c22fd5-bfae-4e09-9894-341f468e08dc@googlegroups.com> |
| In-Reply-To | <05c22fd5-bfae-4e09-9894-341f468e08dc@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:ZHoA9wVH/sQDwD2U2aAkK5Q9qlg5TSLI2Hj+FUrOlq9 ZPtTUIrB0GEzOzKBUBLq2l49ZFsbsjm2WB6gm7g6bSFj0xKUse f2i5OkAz+xPl/pcUoKTnor2Yp22Kp0fe5MZeJA6Jq+As7IlYsr 1/G7bs8GZEKCMcteslESkX47/huRXuV6FSXdWNyh0qQgEnoDqY j2N4W8kyrTy3+njUsLjiR7tpbPaUAXosF5VyC8jb6iGkvNoVf+ j6b6pmMFFIqqzSDuQBcoDRL6Gs3J1MfIVpTNbVHS92dt6Cc5Ni a9ropGxmYUPpJnNTjh2ba2xN0XfjnDQBEDUeC+JOxRuMKObWTL xW+9S/n5EDAqgPzAZGgM= |
| X-UI-Out-Filterresults | notjunk:1; |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17508.1420788672.18130.python-list@python.org> (permalink) |
| Lines | 69 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1420788672 news.xs4all.nl 2878 [2001:888:2000:d::a6]:38698 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:83408 |
Show key headers only | View raw
On 01/09/2015 02:17 AM, jyoti690saini@gmail.com wrote:
> Hello,
>
> Can any one tell me how to create
> graph={
> "nodes": [
> {
> "id": "n0",
> "label": "A node",
> "x": 0,
> "y": 0,
> "size": 3
> },
> {
> "id": "n1",
> "label": "Another node",
> "x": 3,
> "y": 1,
> "size": 2
> },
> {
> "id": "n2",
> "label": "And a last one",
> "x": 1,
> "y": 3,
> "size": 1
> }
> ],
> "edges": [
> {
> "id": "e0",
> "source": "n0",
> "target": "n1",
> "label" : "dfghujikoi"
> },
> {
> "id": "e1",
> "label" : "dfghujikoi",
> "source": "n1",
> "target": "n2"
>
> },
> {
> "id": "e2",
> "source": "n2",
> "target": "n0",
> "label" : "dfghujikoi"
> }
> ]
> }
>
> using python?
>
> its like a hash table and value is an array of hash table ?
> I tried but it was giving error of "List out of index" .
>
You just did. If you'd like to see it, add a print(graph) . What's
your real question?
BTW, in Python, it's called a dict, not a hash table. But you did it
correctly.
And if you want to fetch a particular element, use:
print(graph["edges"][1]["id"])
--
DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Array of hash table jyoti690saini@gmail.com - 2015-01-08 23:17 -0800 Re: Array of hash table Dave Angel <davea@davea.name> - 2015-01-09 02:30 -0500 Re: Array of hash table Peter Otten <__peter__@web.de> - 2015-01-09 08:55 +0100 Re: Array of hash table Jason Friedman <jsf80238@gmail.com> - 2015-01-09 20:38 -0700
csiph-web