2008年5月14日水曜日

テーブル 分解





a = "abc</tr>efg</tr>aaa"
print a
print a.split('</tr>')[0]
print len(a.split('</tr>'))

imgList = "<table>"
imgList += "<tr>"
imgList += "<td>abc1</td>"
imgList += "<td>abc2</td>"
imgList += "<td>abc3</td>"
imgList += "</tr>"
imgList += "<tr>"
imgList += "<td>2abc1</td>"
imgList += "<td>2abc2</td>"
imgList += "<td>2abc3</td>"
imgList += "</tr>"
imgList += "<tr>"
imgList += "<td>3abc1</td>"
imgList += "<td>3abc2</td>"
imgList += "<td>3abc3</td>"
imgList += "</tr>"

imgList += "</table>"

print "imgList",imgList
imgData = imgList[:-8][7:]

print "imgData",imgData

rr = range(0, len(imgData.split('</tr>'))-1 )

for r in rr:
imgRow = imgData.split('</tr>')[r][8:][:-5]

print "r,imgRow:", r,imgRow

imgRow = imgRow.split('</td><td>')

print "imgRow,len(imgRow)",imgRow,len(imgRow)




abc</tr>efg</tr>aaa

abc

3

imgList <table><tr><td>abc1</td><td>abc2</td><td>abc3</td></tr><tr><td>2abc1</td><td>2abc2</td><td>2abc3</td></tr><tr><td>3abc1</td><td>3abc2</td><td>3abc3</td></tr></table>

imgData <tr><td>abc1</td><td>abc2</td><td>abc3</td></tr><tr><td>2abc1</td><td>2abc2</td><td>2abc3</td></tr><tr><td>3abc1</td><td>3abc2</td><td>3abc3</td></tr>

r,imgRow: 0 abc1</td><td>abc2</td><td>abc3

imgRow,len(imgRow) ['abc1', 'abc2', 'abc3'] 3

r,imgRow: 1 2abc1</td><td>2abc2</td><td>2abc3

imgRow,len(imgRow) ['2abc1', '2abc2', '2abc3'] 3

r,imgRow: 2 3abc1</td><td>3abc2</td><td>3abc3

imgRow,len(imgRow) ['3abc1', '3abc2', '3abc3'] 3


Migration Python2.7への移行

1. 以前のプログラムのソースをダウンロードして、 app.xml を変更して deployする 503 python -V // まず Mac にインストールされている python のバージョンを確認 504 pwd 505 curl https://sdk.cl...