find index of row matching a given criteria

I have the following list (nodes):

nodeID, x, y, z=row

I want to find the index of the row which row[0]==nodeAID.

My code is:

nindF=[line[0].index(nodeAID) for line in nodes]

but it gives me the error: TypeError: expected a character buffer object


nindF = [index for index, line in enumerate(nodes) if line[0].find(nodeAID) >= 0]

This will return a list of indexes of all the lines that start with nodeAID. If you only care about the index of the first line that starts with nodeAID then:

nindF = [index for index, line in enumerate(nodes) if line[0].find(nodeAID) >= 0][0]

Need Your Help

Using multiple or only one eventlisteners in actionscript 3

actionscript-3 flash class events actionscript

Sorry for the lame question but I don't know how to search for it. So if I have two events from the same class like:

C parsing a string divided

c parsing

I hate to be that guy asking easy questions but I am bit rusty in my C and something is eluding me here. I am trying to read a file with the following sample text:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.