Size: 951
Comment: 删除对PageComment2组件的引用
|
← Revision 4 as of 2009-12-25 07:14:55 ⇥
Size: 951
Comment: converted to 1.6 markup
|
Deletions are marked like this. | Additions are marked like this. |
Line 6: | Line 6: |
::-- ZoomQuiet [[[DateTime(2008-03-21T02:52:28Z)]]] [[TableOfContents]] |
::-- ZoomQuiet [<<DateTime(2008-03-21T02:52:28Z)>>] <<TableOfContents>> |
Line 9: | Line 9: |
[[Include(CPUGnav)]] | <<Include(CPUGnav)>> |
::-- ZoomQuiet [2008-03-21 02:52:28]
Contents
1. 变量替换技巧
{{{Mr Shore <[email protected]> reply-to [email protected], to "python-cn:CPyUG" <[email protected]>, date Fri, Mar 21, 2008 at 7:13 AM subject [CPyUG:44020] 分享一个变量替换代码 仿tinyp2p }}}
1 def int2str(i):
2 return (i<10) and str(i) or (i<36) and chr(i+55) or int2str(i/36) + int2str(i%36)
3
4 strlist = open(r'D:\work\IR\python\compressjs\keyword.txt').read().split('\n')
5 mplist = []
6
7 for i in range(len(strlist)):
8 mplist.append('_' + int2str(i))
9
10 print mplist
11 s = open(r'D:\work\IR\python\compressjs\table.txt','w')
12 for i,each in enumerate(mplist):
13 s.write(strlist[i])
14 s.write('\t\t')
15 s.write(each)
16 s.write('\n')