Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

get specific index in a list

//this is a fairly crude method but worked for me when iterator
//method didn't work. 

template <class T>
T getItemAtIndex(std::list<T> list, int n) {
	int _pos = 0;
	for (T i : list) {
		if (_pos == n) {
			return i;
		}
		_pos++;
	}
}
Source by www.adamsmith.haus #
 
PREVIOUS NEXT
Tagged: #specific #index #list
ADD COMMENT
Topic
Name
9+8 =