Re: [BangPypers] help to understand this code..

2013-02-25 Thread Srikanth Kamath
Oops Regards Srikanth Kamath, BDM SAARC Sent from my Mobil Device ~ I unable to access emails from laptop, maybe in meeting or ~~travelling hence response will be delayed, thanks for understanding and cooperation. On 25-Feb-2013, at 8:14 PM, Gora Mohanty g...@mimirtech.com wrote: On 25

Re: [BangPypers] Python dictionaries, deleting elements while iterating.

2013-02-25 Thread Anand Chitipothu
On Mon, Feb 25, 2013 at 8:51 PM, Pranjal Mittal pranjal.mittal.ec...@iitbhu.ac.in wrote: Hi all, I was writing a piece of code that deletes items from Python Dictionaries when a certain condition is met. while iterating over the dictionary. http://dpaste.com/hold/995010/ However that

Re: [BangPypers] Python dictionaries, deleting elements while iterating.

2013-02-25 Thread ragsagar
On Mon, Feb 25, 2013 at 9:33 PM, Anand Chitipothu anandol...@gmail.comwrote: You can iterate over items: for key, value in dictionary.items(): if value == 1: del dictionary[key] I think in Python 3.*, dict.items() returns iterator. If so it won't work in Python 3.* . So

Re: [BangPypers] Python dictionaries, deleting elements while iterating.

2013-02-25 Thread Anand Chitipothu
On Mon, Feb 25, 2013 at 9:50 PM, ragsagar ragsa...@gmail.com wrote: On Mon, Feb 25, 2013 at 9:33 PM, Anand Chitipothu anandol...@gmail.com wrote: You can iterate over items: for key, value in dictionary.items(): if value == 1: del dictionary[key] I think in Python

Re: [BangPypers] Python dictionaries, deleting elements while iterating.

2013-02-25 Thread ragsagar
On Mon, Feb 25, 2013 at 10:15 PM, Anand Chitipothu anandol...@gmail.comwrote: I think, the second solution I suggested is more Pythonic than using a for loop. In Python 3, it can be written as a dictionary-comprehension. dictionary = {(k, v) for k, v in dictionary.items() if v != 1} True.

Re: [BangPypers] help to understand this code

2013-02-25 Thread T S KAMATH
My Apologies for yesterdays post.. It was click send instead of draft.. Moderator pls del the earlier post. I am no developer nor a hardcore programer. I just use open Source to find work around to issues and or to automate. all my stuff is open source and free to use. Hence pls excuse if

Re: [BangPypers] Listing files in a folder using python

2013-02-25 Thread Baishampayan Ghose
I didn't read the whole PHP code, but I guess you are trying to scan a directory for files, etc. This can be accomplished using the os.walk function in Python - http://docs.python.org/2/library/os.html#os.walk Regards, BG On Tue, Feb 26, 2013 at 8:19 AM, T S KAMATH tsk.kam...@gmail.com wrote:

Re: [BangPypers] help to understand this code

2013-02-25 Thread Gopalakrishnan Subramani
I still recommend you go through the fundamentals of Python, I don't see any hurry in learning something new. Starts with printing hello world, then conditions, loops, functions, Class, Objects. You don't need more than 2 weeks for this homework. Couple of late nights and weekends help you, It is

Re: [BangPypers] Python dictionaries, deleting elements while iterating.

2013-02-25 Thread Navin Kabra
Anand Chitipothu anandol...@gmail.com writes: loop. In Python 3, it can be written as a dictionary-comprehension. Dictionary and set comprehensions are also available in Python 2.7 ___ BangPypers mailing list BangPypers@python.org