2013-10-24 22 views

回答

2

你想用getattr在Python中的動態屬性檢索時:

col = 'col1' 
getattr(table, col) 
+0

謝謝約翰,它幫助 –

1

要按名稱獲取屬性值,請使用getattr

getattr(table, 'col1') 
+0

謝謝alko。 –