Keep track of tagPath when utilizing system.tag.readAll

Hi,

I am trying to write some script to pull certain tag parameters from all tags in my project.
I have found that using system.tag.read in a for loop is pretty inefficient, and am trying to do the same thing using system.tag.readAll which seems much faster.

How can i write this in python such that the index of a list can be tracked to provide the tagPath for any tag that returns a certain value?

tags = system.tag.browseTags(path,recursive=True)
	
tagPaths = [tag.fullPath + ".HistoryEnabled" for tag in tags]
print tagPaths	

qvTags = system.tag.readAll(tagPaths)
histEN = [tag.value for tag in qvTags]
print histEN

So now i just need to find a way to get all tagPaths that are associated with a histEN item equal to 1.

Use zip()!

combined = zip(tags,qvTags)
for k,v in combined:
    print k.fullPath,v.value
3 Likes

Awesome thanks. Ended up using enumerate but i like zip better, will go back and change now. Cheers