Feb-02-2018, 03:00 AM
Hello,
I have the following data:
CONST robtarget robttarget1:=[[-42277.480909368,-4997.36320197,2332.380745999],[0.347787091,-0.799426288,0.217080241,0.439133144],[0,0,0,0],[-35700.001525879,180.000020668,2200.000095367,0,9E9,9E9]];
CONST robtarget robttarget2:=[[-41999.578125,-4703.04296875,2485.273193359],[0.382563147,-0.862604063,0.215021279,0.251645621],[0,0,0,0],[-35700.001525879,180.000020668,2200.000095367,0,9E9,9E9]];
CONST robtarget robttarget3:=[[-41823.44921875,-4460.583984375,2579.253662109],[0.178574824,-0.942134265,0.267469035,0.09462755],[0,0,0,0],[-35700.001525879,180.000020668,2200.000095367,0,9E9,9E9]];
Each line is a robot target for an ABB robot.
I need to find these specific values towards the end of each line:
-35700.001525879,180.000020668,2200.000095367,0,9E9,9E9]];
-35700.001525879,180.000020668,2200.000095367,0,9E9,9E9]];
-35700.001525879,180.000020668,2200.000095367,0,9E9,9E9]];
With the left values, -35700.00, -35700.00, -35700, I apply absolute value > then replace.
With the right values, 180.00, 180.00, 180.00, I subtract 180 > then replace.
so far all I have is loop through each line of a file, and output the type. So I know each line is a string.
I don't know the next step. If you could help point towards the next step that would be awesome!
I have the following data:
CONST robtarget robttarget1:=[[-42277.480909368,-4997.36320197,2332.380745999],[0.347787091,-0.799426288,0.217080241,0.439133144],[0,0,0,0],[-35700.001525879,180.000020668,2200.000095367,0,9E9,9E9]];
CONST robtarget robttarget2:=[[-41999.578125,-4703.04296875,2485.273193359],[0.382563147,-0.862604063,0.215021279,0.251645621],[0,0,0,0],[-35700.001525879,180.000020668,2200.000095367,0,9E9,9E9]];
CONST robtarget robttarget3:=[[-41823.44921875,-4460.583984375,2579.253662109],[0.178574824,-0.942134265,0.267469035,0.09462755],[0,0,0,0],[-35700.001525879,180.000020668,2200.000095367,0,9E9,9E9]];
Each line is a robot target for an ABB robot.
I need to find these specific values towards the end of each line:
-35700.001525879,180.000020668,2200.000095367,0,9E9,9E9]];
-35700.001525879,180.000020668,2200.000095367,0,9E9,9E9]];
-35700.001525879,180.000020668,2200.000095367,0,9E9,9E9]];
With the left values, -35700.00, -35700.00, -35700, I apply absolute value > then replace.
With the right values, 180.00, 180.00, 180.00, I subtract 180 > then replace.
so far all I have is loop through each line of a file, and output the type. So I know each line is a string.
I don't know the next step. If you could help point towards the next step that would be awesome!
#!/usr/bin/env python import re axis = open("robots.txt", "r") for line in axis: print(type(line))