Hi Ron I have always found regular expressions to be too hard to read. You
can isolate the data you need in a more legible and easy to debug way just
using for loops. I always try to get the python code to reasonably closely
resemble the verbal explanation of the code. Below is a small example where
I have isolated the position data.
Pete
##########################################################################
file = open('/your/path/AE_to_Nuke.txt')
f = file.read()
theSplitFile = f.split("\r")
file.close()
theFileWithLineNumbers = zip(range(len(theSplitFile)),theSplitFile)
theNumberOfLines = len(theFileWithLineNumbers)
thePositionData = []
for i in range(theNumberOfLines):
if "Position" in theFileWithLineNumbers[i][1]:
thePositionLineNumber = theFileWithLineNumbers[i][0]
for anItem in theFileWithLineNumbers[thePositionLineNumber+2:]:
if anItem[1] == "":
break
else:
thePositionData.append(anItem[1].strip().split("\t"))
theFrames = []
theXvalues = []
theYvalues = []
for anItem in thePositionData:
theFrames.append(anItem[0])
theXvalues.append(anItem[1])
theYvalues.append(anItem[2])
On Wed, Jun 27, 2012 at 2:26 AM, Wouter Klouwen <[email protected]>wrote:
> On 26/06/2012 10:13, Wouter Klouwen wrote:
>
>> On 25/06/2012 19:15, Ron Ganbar wrote:
>>
>>> Hi Wouter,
>>> I tried this kinda thing for the regex strings:
>>> regex =
>>> re.compile('\\t+([-+]?\d+\.?\**d*)\\t+([-+]?\d+\.?\d*)\\t+([-**
>>> +]?\d+\.?\d*)\\t+([-+]?\d+\.?\**d*)\\t+')
>>>
>>>
>> I'd recommend:
>>
>> re.compile('[ \\t]+([-+]?\d+\.?\d*){4}[ \\t]+')
>>
>
> Whoops, just realised it should be:
>
> re.compile('([ \\t]+([-+]?\d+\.?\d*)){4}[ \\t]+')
>
>
>
> HTH,
> Wouter
>
>
> --
> Wouter Klouwen, Software Engineer
> The Foundry, 6th Floor, Comms Building, 48 Leicester Sq, London WC2H LT
> Tel: +442079686828 • Fax: +4420 79308906 • thefoundry.co.uk
> The Foundry Visionmongers Ltd • Reg.d in England and Wales No: 4642027
>
>
> ______________________________**_________________
> Nuke-python mailing list
> Nuke-python@support.**thefoundry.co.uk<[email protected]>,
> http://forums.thefoundry.co.**uk/ <http://forums.thefoundry.co.uk/>
> http://support.thefoundry.co.**uk/cgi-bin/mailman/listinfo/**nuke-python<http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python>
>
--
-
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python