4

I'm using PyScripter on Windows with Python 2.7.3 and I'm trying to import json. It seems to work if I use the interpreter directly, but when saved in a file and run I get 'module' object has no attribute 'loads'.

import json

j = '{"one": 1, "numbers": [1, 2, 3.5]}'

x = json.loads(j)

Interpreter for x returns, {u'numbers': [1, 2, 3.5], u'one': 1}

I'm fairly new to Python so I'm sorry if this is an idiotic question. Many thanks

Cédric Julien
  • 78,516
  • 15
  • 127
  • 132
user1414464
  • 41
  • 1
  • 2

0 Answers0