파이썬 3.x
import json
converted_table_columns_file = "data.json" #json파일이 파이썬 파일과 같은 경로에 있을 경우
json_file = open(converted_table_columns_file)
data = json.load(json_file)
for item in data:
column1 = item["column1"]
column2 = item["column2"]
column3 = item["column3"]
column4 = item["column4"]
column5 = item["column5"]
data.json
[
{
"column1": 1,
"column2": 2,
"column3": 3,
"column4": 4,
"column5": 5
},
{
"column1": 11,
"column2": 12,
"column3": 13,
"column4": 14,
"column5": 15
},
{
"column1": 21,
"column2": 22,
"column3": 23,
"column4": 24,
"column5": 25
},
{
"column1": 31,
"column2": 32,
"column3": 33,
"column4": 34,
"column5": 35
},
{
"column1": 41,
"column2": 42,
"column3": 43,
"column4": 44,
"column5": 45
},
{
"column1": 51,
"column2": 52,
"column3": 53,
"column4": 54,
"column5": 55
},
{
"column1": 61,
"column2": 62,
"column3": 63,
"column4": 64,
"column5": 65
},
{
"column1": 71,
"column2": 72,
"column3": 73,
"column4": 74,
"column5": 75
},
{
"column1": 81,
"column2": 82,
"column3": 83,
"column4": 84,
"column5": 85
},
{
"column1": 91,
"column2": 92,
"column3": 93,
"column4": 94,
"column5": 95
},
{
"column1": 101,
"column2": 102,
"column3": 103,
"column4": 104,
"column5": 105
},
{
"column1": 111,
"column2": 112,
"column3": 113,
"column4": 114,
"column5": 115
},
{
"column1": 121,
"column2": 122,
"column3": 123,
"column4": 124,
"column5": 125
},
{
"column1": 131,
"column2": 132,
"column3": 133,
"column4": 134,
"column5": 135
},
{
"column1": 141,
"column2": 142,
"column3": 143,
"column4": 144,
"column5": 145
},
{
"column1": 151,
"column2": 152,
"column3": 153,
"column4": 154,
"column5": 155
},
{
"column1": 161,
"column2": 162,
"column3": 163,
"column4": 164,
"column5": 165
},
{
"column1": 171,
"column2": 172,
"column3": 173,
"column4": 174,
"column5": 175
},
{
"column1": 181,
"column2": 182,
"column3": 183,
"column4": 184,
"column5": 185
}
]
'Web_Application > python' 카테고리의 다른 글
[python][ubuntu] scrapy install error - setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 (0) | 2019.04.23 |
---|---|
[python] excel 시트간 데이터 비교 후 서식으로 차이 표시 (0) | 2019.04.16 |
[python] sp 명으로 sp create 구문 가져오기 (0) | 2019.04.08 |
[python][jellyfish] 문자열 유사도 (jaro distance) (0) | 2019.03.26 |
[python] excel to json (0) | 2019.02.08 |