any one can write code for the above tittle
3 1860
Can you give an example of what you're looking for? As I understand it the "index" relates to the position of elements in a "list", so "index of items in list view" is a little confusing (to me). Do you by chance want to print out each item in some sequence data?
bvdet 2,851
Expert Mod 2GB
any one can write code for the above tittle
Are you asking a question? Could you be more specific - maybe show an example of what you need? Following is a function I use that returns an index list: - s = [1,2,3,4,1,2,3,4,1,2,4,3,4,5,6,6,7,8,9,1,2,3,4,5,6,7,3,2,1]
-
-
def get_index(s, item):
-
i = 0
-
i_list = []
-
while True:
-
try:
-
i = s.index(item, i)
-
i_list.append(i)
-
i += 1
-
except:
-
break
-
return i_list
-
-
-
print get_index(s, 1)
-
print get_index(s, 4)
-
print get_index(s, 7)
-
print get_index(s, 0)
-
-
>>> [0, 4, 8, 19, 28]
-
[3, 7, 10, 12, 22]
-
[16, 25]
-
[]
-
>>>
A list view sounds like a GUI element. Is this correct? (oh, boy, I love guessing games) If so, which Toolkit are you using?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Andrew Dalke |
last post by:
Is there an author index for the new version of the
Python cookbook? As a contributor I got my comp version
delivered today and my ego wanted some gratification.
I couldn't find my entries.
...
|
by: Jax |
last post by:
Dear all,
I have a list view, i dont like this list view very much
anymore as it hasn't been the easiest object to use thus
far.
Now i like it even less.
I have a problem with it, I wish to...
|
by: Brian Henry |
last post by:
Since no one else knew how to do this I sat here all morning experimenting
with this and this is what I came up with... Its an example of how to get a
list of items back from a virtual mode list...
|
by: Rich |
last post by:
Yes, I need to store some values in an array type collection object that can
hold 3 or more parameters per index. I have looked at the collection object,
hashtable object and would prefer not to...
|
by: Brian Henry |
last post by:
So what is the easiest way to do this? I have one list view with a list of
items (in detail view and with about 20 sub items) and a second list view
that will take the items they drag from the...
|
by: Adam Honek |
last post by:
This is probably a silly question but oh well, I can't find the answer
looking via code.
Having an imagelist already, how does one set an icon for a list view's sub
items?
I'm using the code...
|
by: lb |
last post by:
Hello,
I am trying to use a radiobuttonlist with the new multiview control. Am
having trouble understanding how to build the radiobuttonlsit just one time,
and not many times.
In my first...
|
by: Santosh |
last post by:
Dear all ,
i am writting following code.
if(Page.IsPostBack==false)
{
try
{
BindSectionDropDownlist();
|
by: =?Utf-8?B?SmFtZXMgUGFnZQ==?= |
last post by:
I've a multiview with 3 views. on view 2 the user is presented with a check
box list (items from database) at view 3 the user can review their selections
and, either post to the database or go back...
|
by: Riccardo Murri |
last post by:
Hello,
I have some code that stops when trying to find a graph in a list of
similar graphs::
(Pydb) list
110 try:
111 canonical = self.base
112 except ValueError:
113 ...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |