This is my code
JavaScript
x
7
1
import fileinput
2
import json
3
4
with fileinput.input(files=('bot_details.json')) as f:
5
my_load = json.load(f)
6
TOKEN=my_load["TOKEN"]
7
I’m getting this error,
AttributeError: 'FileInput' object has no attribute 'read'
Advertisement
Answer
For a single file use open
JavaScript
1
4
1
with open('bot_details.json') as f:
2
my_load = json.load(f)
3
TOKEN=my_load["TOKEN"]
4