regex - Get text between curly brackets in python -
i'm trying text out of curly brackets of text:
circle(265.17373,-53.674312,1") # text={1} circle(265.17373,-53.674312,2") # text={2}
for stuff between parenthesis use , works
array = np.append(array, np.array([float(x) x in re.findall(r"\d+(?:\.\d+)?", line)]))
but want text inside of curly brackets.
array2 = np.append(array2, np.array([float(x) x in re.findall(r"/\{([^}]+)\}/", line)]))
but not give anything.
you need remove forward slash present inside second line of code.
array2 = np.append(array2, np.array([float(x) x in re.findall(r"\{([^}]+)\}", line)]
Comments
Post a Comment