Fork me on GitHub

Other articles


  1. On the BeGinNing

    Welcome to visit 'python-NOTes' category in LuCima's SpaCe. Here gathers several posts summerized advanced usages, tips and black techs about Python. All contents are based on Python 3.x, though Python 2.x may be referred to shortly.

    read more
  2. Operaions on Basic data structure -- dict

    Series of posts (2)

    If you want to build up a dict using two lists, zip() can be used as this:
    dict(zip(list_a, list_b))

    Sometimes, OrderedDict and DefaultDict in module collections can be useful. When you need a dict whose keys are

    read more
  3. Operaions on Basic data structure -- list

    Series of posts (1)

    Here I am going to summarize some advancing operations about list, which is one of the most commonly used data structure in Python. Basic usage of list will be skipped.

    The built-in function sorted() is helpful for sorting the list or …

    read more
  4. One application of yield

    When you want to generate an iterable letter list such as ['A', 'B', ..., 'J'], using yield will be very graceful.
    An example is listed below:

    def letter_increment(letter):
        assert len(letter) == 1
        return chr(ord(letter) + 1)
    
    def iter_letter(start_letter='A', end_letter='J'):
        current_letter = start_letter
        while True:
            yield current_letter
            if …
    read more

links

social