numberofrow, 它的值是在表單字段中動態設置的。動態處理python字符串或列表
現在因爲numberofrow是在多個表中, 當我接收從形式變量,
如果只有一個numerofrow,其字符串,用於離。 numberofrow = 01
如果多於一個numberofrow,它的一個列表,例如。 numberofrow = [01,02,04]
現在我如何區分是否它的列表或字符串在我的Python代碼?使用
在想,
if type(numberofrow).__name__=='list':
#do this
else:
#do this
感謝, 陽光。
重複http://stackoverflow.com/questions/3227552/what-is-the-pythonic-way-of-differentiating-between-a-string-and-a-list? – Johnsyweb 2010-08-18 05:37:48