problem.getnamelist
problem.getnamelist |
Purpose
Returns the names for the rows, columns or sets in a given range. The names will be returned in a list of Python strings.
Synopsis
names = problem.getnamelist(type, first, last);
Arguments
type
|
|
||||||
names
|
A list containing all returned names.
|
||||||
first
|
First row, column or set in the range. If
None, it is taken as zero.
|
||||||
last
|
Last row, column or set in the range. If
None, it is taken as the penultimate element in the list defined by
type.
|
Example
The following example retrieves and outputs the row and column names for the current problem.
cols = prob.attributes.cols rows = prob.attributes.rows rnames = prob.getnamelist(1, 0, rows - 1) cnames = prob.getnamelist(2, 0, rows - 1) for k,v in enumerate(rnames): print("Row {0:4d}: {1}", k, v) for k,v in enumerate(cnames): print("Column {0:4d}: {1}", k, v)