Re: How to run python script in emacs

2009-09-26 Thread Join hack
you can use emacs command shell for that

2009/9/26 devilkin devilsp...@gmail.com

 I'm just starting learning python, and coding in emacs. I usually
 split emacs window into two, coding in one, and run script in the
 other, which is not very convenient. anyone can help me with it? is
 there any tricks like emacs short cut?

 also please recommand some emacs plug-ins for python programming, i'm
 also beginner in emacs.currently i'm only using python.el. Are any
 plugins supply code folding and autocomplete?

 BTW, I'm not a english native speaker, any grammer mistakes, please
 correct them. :)
 --
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ARP Request/reply in Python

2009-09-24 Thread Join hack
you can use pylibpcap http://pylibpcap.sourceforge.net/ .

2009/9/23 Nattapong Limprungpattanakit nattapon...@hotmail.com

  Hello all.

 I want check Mac Address Client on network which alive help me please.

 Thanks.

 --
  Windows Live ??? ? ??? 
 http://www.microsoft.com/thailand/windows/windowslive/products/photo-gallery-edit.aspx

 --
 http://mail.python.org/mailman/listinfo/python-list


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Remove empty strings from list

2009-09-14 Thread Join hack
good solution ,thanks~!

2009/9/15 Steven D'Aprano ste...@remove.this.cybersource.com.au

 On Mon, 14 Sep 2009 18:55:13 -0700, Chris Rebert wrote:

  On Mon, Sep 14, 2009 at 6:49 PM, Helvin helvin...@gmail.com wrote:
 ...
   I have looked at documentation, and how strings and lists work, but I
   cannot understand the behaviour of the following:
 ...
  for item in list:
  if item is ' ':
  print 'discard these: ',item
  index = list.index(item)
  del list[index]

 ...

  Moral: Don't modify a list while iterating over it. Use the loop to
  create a separate, new list from the old one instead.


 This doesn't just apply to Python, it is good advice in every language
 I'm familiar with. At the very least, if you have to modify over a list
 in place and you are deleting or inserting items, work *backwards*:

 for i in xrange(len(alist), -1, -1):
item = alist[i]
if item == 'delete me':
del alist[i]


 This is almost never the right solution in Python, but as a general
 technique, it works in all sorts of situations. (E.g. when varnishing a
 floor, don't start at the doorway and varnish towards the end of the
 room, because you'll be walking all over the fresh varnish. Do it the
 other way, starting at the end of the room, and work backwards towards
 the door.)

 In Python, the right solution is almost always to make a new copy of the
 list. Here are three ways to do that:


 newlist = []
 for item in alist:
if item != 'delete me':
 newlist.append(item)


 newlist = [item for item in alist if item != 'delete me']

 newlist = filter(lambda item: item != 'delete me', alist)



 Once you have newlist, you can then rebind it to alist:

 alist = newlist

 or you can replace the contents of alist with the contents of newlist:

 alist[:] = newlist


 The two have a subtle difference in behavior that may not be apparent
 unless you have multiple names bound to alist.



 --
 Steven
 --
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list