I got a script that reads a file from a mapped drive and returns the latest entry…
import re
def get_file_part(machine):
path = ('Z:\Qa_Reports\Daily Production Data\%s\%s_PCM.txt' % (machine,machine))
x = system.file.readFileAsString(path)
result = re.findall('\s\d\d\d\s', x)
z = result[-1]
t = z.strip
return t
op = lot.get_file_part('D3')
system.tag.write('[default]SCADA/playground/New Tag 1',op)
I’ve tried several things including below:
z = result[-1].strip
return z
No matter what I seem to do. I get the following returned.
I think you can format tags to remove leading and trailing whitespaces but that is besides the point