0

This is my code

# -*- coding: utf-8 -*-
import json
import re

with open("/Users/paul/Desktop/file.json") as json_file:
    file = json.load(json_file)
print file["desc"]

key="capacità"
result = re.findall("((?:[\S,]+\s+){0,3})"+key+"\s+((?:[\S,]+\s*){0,3})", file["desc"], re.IGNORECASE)
print result

This is the content of the file

{
    "desc": "Frigocongelatore, capacit\u00e0 di 215 litri, h 122 cm, classe A+"
}

My result is []

but what I want is result = "capacità"

Usi Usi
  • 2,967
  • 5
  • 38
  • 69
  • Take a look at this answer http://stackoverflow.com/a/5096928/797495 – Pedro Lobito Oct 06 '15 at 02:03
  • I originally voted the other one as a duplicate of this one, but arguably it should be the other way around. The original question is messier, but has answers and discussion. – tripleee Oct 06 '15 at 03:52

0 Answers0