Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #64652

Re: Can post a code but afraid of plagiarism

Path csiph.com!usenet.pasdenom.info!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'skip:[ 20': 0.04; 'assignment': 0.07; 'cache': 0.07; 'nested': 0.07; 'subject:code': 0.07; 'exception.': 0.09; 'host,': 0.09; 'kumar': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'steps:': 0.09; 'jan': 0.12; 'message-id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'skip:> 20': 0.16; 'subject:post': 0.16; 'tuple': 0.16; 'typo': 0.16; 'wed,': 0.18; 'trying': 0.19; 'input': 0.22; 'print': 0.22; 'error': 0.23; 'url:home': 0.24; 'header:X-Complaints-To:1': 0.27; 'host': 0.29; "doesn't": 0.30; 'skip:( 20': 0.30; 'easier': 0.31; "skip:' 10": 0.31; 'extract': 0.31; 'figure': 0.32; 'checking': 0.33; 'mac': 0.33; 'there': 0.35; 'really': 0.36; 'skip:> 10': 0.36; 'entry': 0.36; 'useful': 0.36; 'charset:us-ascii': 0.36; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'subject:Can': 0.60; 'first': 0.61; 'fields).': 0.84; 'received:108': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Can post a code but afraid of plagiarism
Date Thu, 23 Jan 2014 20:26:13 -0500
Organization IISS Elusive Unicorn
References <e646d6f1-ac3c-4d55-9809-b5edee93dbbb@googlegroups.com> <4c3009ee-bf97-4d93-83e6-0bc4b2a90e82@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host adsl-108-79-218-11.dsl.klmzmi.sbcglobal.net
X-Newsreader Forte Agent 6.00/32.1186
X-No-Archive YES
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.5924.1390526775.18130.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1390526775 news.xs4all.nl 2841 [2001:888:2000:d::a6]:52421
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:64652

Show key headers only | View raw


On Wed, 22 Jan 2014 23:46:36 -0800 (PST), indar kumar
<indarkumar59@gmail.com> declaimed the following:


>I have following nested dictionary
>
>hosts={'PC2': ['02:02:02:02:02:02', '192.168.0.2', '200', {'192.168.0.2': ('02:02:02:02:02:02', 1390461798.531)}], 'PC1': ['01:01:01:01:01:01', '192.168.0.1', '200', {'192.168.0.2': ('02:02:02:02:02:02', 1390461798.531), '192.168.0.1': ('01:01:01:01:01:01', 1390461787.78)}]}
>
>
>How can I print a particular tuple from this table?
>
>
>What I am trying to do is
>input1=raw_input("Please enter id of host and IP that you want to be resolved")
>z=input1.split()
>print("PC3 resolved"+' '+z[1]+' to'+hosts[z[0]][3] z[1])
>

	This would be a lot easier for you to figure out if you do it in steps:

First extract all the data for the user provided host (and use tuple
assignment to give useful names to the input fields).

host, ip = raw_input("...").split()
aHost = hosts[host]
cache = aHost[3]
ipMap = cache[ip]
MAC = ipMap[0]

(If you really want the all-in-one: MAC = hosts[host][3][ip][0]		)

	Note that there is no error checking in that -- if the input has a typo
and doesn't find an entry the program will die with an exception.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-18 14:21 -0800
  Re: Can post a code but afraid of plagiarism Roy Smith <roy@panix.com> - 2014-01-18 17:27 -0500
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-18 14:32 -0800
    Re: Can post a code but afraid of plagiarism Roy Smith <roy@panix.com> - 2014-01-18 17:35 -0500
    Re: Can post a code but afraid of plagiarism Chris Angelico <rosuav@gmail.com> - 2014-01-19 09:42 +1100
    Re: Can post a code but afraid of plagiarism Ben Finney <ben+python@benfinney.id.au> - 2014-01-19 09:59 +1100
    Re: Can post a code but afraid of plagiarism Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-19 06:31 +0000
      Re: Can post a code but afraid of plagiarism Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-01-18 22:45 -0800
      Re: Can post a code but afraid of plagiarism Dan Stromberg <drsalists@gmail.com> - 2014-01-19 21:21 -0800
      Re: Can post a code but afraid of plagiarism Chris Angelico <rosuav@gmail.com> - 2014-01-20 17:21 +1100
        Re: Can post a code but afraid of plagiarism Roy Smith <roy@panix.com> - 2014-01-20 09:08 -0500
          Re: Can post a code but afraid of plagiarism Rustom Mody <rustompmody@gmail.com> - 2014-01-20 08:11 -0800
          Re: Can post a code but afraid of plagiarism Terry Reedy <tjreedy@udel.edu> - 2014-01-20 16:56 -0500
          Re: Can post a code but afraid of plagiarism Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-21 00:47 +0000
            Re: Can post a code but afraid of plagiarism Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-01-21 10:32 +0000
              Re: Can post a code but afraid of plagiarism Dan Sommers <dan@tombstonezero.net> - 2014-01-21 13:49 +0000
      Re: Can post a code but afraid of plagiarism Ben Finney <ben+python@benfinney.id.au> - 2014-01-20 18:39 +1100
        Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-19 23:55 -0800
          Re: Can post a code but afraid of plagiarism Ben Finney <ben+python@benfinney.id.au> - 2014-01-20 19:17 +1100
            Re: Can post a code but afraid of plagiarism Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-22 00:51 +0000
              Re: Can post a code but afraid of plagiarism Rustom Mody <rustompmody@gmail.com> - 2014-01-21 19:01 -0800
                Re: Can post a code but afraid of plagiarism Roy Smith <roy@panix.com> - 2014-01-21 22:46 -0500
          Re: Can post a code but afraid of plagiarism Chris Angelico <rosuav@gmail.com> - 2014-01-20 19:48 +1100
          Re: Can post a code but afraid of plagiarism bryan rasmussen <rasmussen.bryan@gmail.com> - 2014-01-20 10:19 +0100
          Re: Can post a code but afraid of plagiarism Alister <alister.ware@ntlworld.com> - 2014-01-20 09:36 +0000
          Re: Can post a code but afraid of plagiarism Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-22 00:01 +0000
        Re: Can post a code but afraid of plagiarism Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-22 00:51 +0000
          Re: Can post a code but afraid of plagiarism Neil Cerutti <neilc@norwich.edu> - 2014-01-22 13:34 +0000
      Re: Can post a code but afraid of plagiarism Chris Angelico <rosuav@gmail.com> - 2014-01-20 18:59 +1100
      Re: Can post a code but afraid of plagiarism Ben Finney <ben+python@benfinney.id.au> - 2014-01-20 19:10 +1100
  Re: Can post a code but afraid of plagiarism Ben Finney <ben+python@benfinney.id.au> - 2014-01-19 09:57 +1100
  Re: Can post a code but afraid of plagiarism Grant Edwards <invalid@invalid.invalid> - 2014-01-19 16:22 +0000
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 00:36 -0800
    Re: Can post a code but afraid of plagiarism Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-22 08:53 -0500
    Re: Can post a code but afraid of plagiarism Rustom Mody <rustompmody@gmail.com> - 2014-01-22 08:48 -0800
    Re: Can post a code but afraid of plagiarism Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-23 00:01 +0000
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 00:39 -0800
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 08:33 -0800
    Re: Can post a code but afraid of plagiarism Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-22 22:36 -0500
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 08:46 -0800
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 08:50 -0800
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 08:53 -0800
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 09:09 -0800
    Re: Can post a code but afraid of plagiarism Ned Batchelder <ned@nedbatchelder.com> - 2014-01-22 14:19 -0500
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 23:46 -0800
    Re: Can post a code but afraid of plagiarism Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-23 20:26 -0500
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-22 23:57 -0800
    Re: Can post a code but afraid of plagiarism Asaf Las <roegltd@gmail.com> - 2014-01-23 01:46 -0800
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-23 02:10 -0800
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-23 13:15 -0800
    Re: Can post a code but afraid of plagiarism Emile van Sebille <emile@fenx.com> - 2014-01-23 13:28 -0800
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-23 13:34 -0800
    Re: Can post a code but afraid of plagiarism Emile van Sebille <emile@fenx.com> - 2014-01-23 13:49 -0800
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-23 13:56 -0800
    Re: Can post a code but afraid of plagiarism Piet van Oostrum <piet@vanoostrum.org> - 2014-01-24 15:13 +0100
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-23 19:15 -0800
    Re: Can post a code but afraid of plagiarism Rustom Mody <rustompmody@gmail.com> - 2014-01-23 21:57 -0800
    Re: Can post a code but afraid of plagiarism Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-24 08:13 +0000
  Re: Can post a code but afraid of plagiarism indar kumar <indarkumar59@gmail.com> - 2014-01-23 23:14 -0800
    Re: Can post a code but afraid of plagiarism Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-24 09:01 -0500
    Re: Can post a code but afraid of plagiarism bob gailer <bgailer@gmail.com> - 2014-01-24 18:42 -0500
    Re: Can post a code but afraid of plagiarism Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-24 19:42 -0500

csiph-web