Experience of Python learning Week4

 

First of all , I have learnt the List Comprehensions in python , it’s quite simple , like this :

 

But however, due to the limit of storage usage , if we creat a list of 10,000,000 elements , it’ll take so much space , and if we only need the top several elements , the elements behind it will be wasted. So people with clever mind come up with a good idea , it’s the Generator. Just make “[]” become “()”,then it comes to a success. But generator only has ‘__next()__’ function , but you can use for loop to fetch the data . One thing  very important is that ‘yield’ sentence could make Concurrent operation in one operation line.

After that is the Iterator , everything that is the object of FOR is Iterable ,  and that could be the object of next() is Iterator.

Then is the Decorator: you can use it to add new functions to you old function.

Json&pickle serialization: 1.json : string — > python data type 2.pickle: python special data type —> python data type.

Built-in functions: …

posted on 2017-08-28 14:47  AdamAG  阅读(107)  评论(0)    收藏  举报

导航