You can use aString.startswith("BEGIN") to test if a string object starts with 
a prefix.
But I decided to just write a full example, with comments:

http://pastebin.com/MEDTr5A0

This example will open the file, and parse every single agent into a final 
dictionary object.

Here is a second version of that function which can take an optional prefix, 
which must match against the agent name to be included:
http://pastebin.com/JcrxTpwN

-- justin



On May 6, 2013, at 8:20 PM, Bay wrote:

> Hi all, 
>       as part of my class I hope to be able to extract the world space 
> location of a particular group of agents in my Massive project (In this case, 
> the Ultralisk agents, at the end of apf file) so that I may bake their 
> location for every frame in another Maya file so that I could attach effects 
> to their animation. 
> 
> 
>      While I have been able to read the file and extract the position of all 
> the root joints location(b_Waist_JNT) I do not know how to get it to 
> specifically read each line till it gets to BEGIN Ultralisk THEN take the 
> b_Waist_JNT information. 
> 
> Basically I just want to know how to get Python to look for a string in every 
> line it's reading in a file,  THEN look for a particular line after if i'm 
> making sense here. 
> 
> Any advice offered would be much appreciated. 
> 
> Thank you
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 
> <frame.1.apf>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to