I have a simple question: I want to just grab the content of a line from a file x. My file x looks like this:
PointXY
[387.93852, 200.0]
PointXY
[200.0, 387.93852]
PointXY
[200.0, 387.93852]
PointXY
[200.0, 353.20889]
PointXY
[387.93852, 200.0]
PointXY
[200.0, 387.93852]
PointXY
[200.0, 300.0]
My script in Python looks like this:
h = open("x.gcode", "r")
searchlines = h.readlines()
file = ""
for i, line in enumerate(searchlines):
if "PointXY" in line:
P = searchlines[i+1]
print(P)
I want P to just be [200.0, 100.0] (for instance). It now gives me '[200.0, 100.0]\n'. How can I adjust this in the line "P = searchlines[i+1]"?