可爱的python

每天在checkio上写一道题来锻炼锻炼思维

今天写完morse clock之后观摩best solution的时候学习了两样东东:

dev:python3.3

1.str.format()

eg. 

>>>'{0:02b} '.format(2)

10

'''

{} : replacement_field

':' indicator

in this example,

0 : fieldname

02b :form_spec, just like %02b in c

'''

2.replace()

string.replace(s, old, new[, maxreplace])

eg.

>>> '010000'.replace('0','.')
'.1....'

’replace or match’ may involve some problems about greedy match, for further discussion

for further discusion

高手写的东东确实值得消化,重要的不是解决了问题,而是为什么要解决这个问题以及如何高效地解决问题。

赞同一种观点,好的程序员都是有好想法的家伙~么么

 

posted @ 2013-09-05 22:34  rainy.mayday  阅读(243)  评论(0)    收藏  举报