获取错误json.decoder.JSONDecodeError错误:期望值:第1行第1列(字符0)

2024-10-01 05:03:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我在简单的json合并中遇到了这个错误,我不知道是什么导致了这个错误,我使用的是python3.6

import glob
import json

result = []
for f in glob.glob("*.json"):
    with open(f, "rb") as infile:
        result.append(json.load(infile))

with open("merged_file.json", "wb") as outfile:
    json.dump(result, outfile)

我正在尝试合并的示例json

[{"player_id": 1, "year": "2013", "game_id": "201310200mia", "date": "2013-10-20", "game_number": "6", "age": "26.268", "team": "MIA", "game_location": "H", "opponent": "BUF", "game_won": false, "player_team_score": "21", "opponent_score": "23", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 0, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 1, "year": "2013", "game_id": "201310270nwe", "date": "2013-10-27", "game_number": "7", "age": "26.275", "team": "MIA", "game_location": "A", "opponent": "NWE", "game_won": false, "player_team_score": "17", "opponent_score": "27", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 0, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0.0, "defense_tackles": 1, "defense_tackle_assists": 2, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 1, "year": "2013", "game_id": "201310310mia", "date": "2013-10-31", "game_number": "8", "age": "26.279", "team": "MIA", "game_location": "H", "opponent": "CIN", "game_won": true, "player_team_score": "22", "opponent_score": "20", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 0, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 1, "year": "2013", "game_id": "201311110tam", "date": "2013-11-11", "game_number": "9", "age": "26.290", "team": "MIA", "game_location": "A", "opponent": "TAM", "game_won": false, "player_team_score": "19", "opponent_score": "22", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 0, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}]

还有一个(我有5000多个json需要合并)

[{"player_id": 5, "year": "2015", "game_id": "201510110gnb", "date": "2015-10-11", "game_number": "5", "age": "24.298", "team": "GNB", "game_location": "H", "opponent": "STL", "game_won": true, "player_team_score": "24", "opponent_score": "10", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 0, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2015", "game_id": "201510180gnb", "date": "2015-10-18", "game_number": "6", "age": "24.305", "team": "GNB", "game_location": "H", "opponent": "SDG", "game_won": true, "player_team_score": "27", "opponent_score": "20", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 0, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 1, "kick_return_yards": 30, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2015", "game_id": "201511010den", "date": "2015-11-01", "game_number": "7", "age": "24.319", "team": "GNB", "game_location": "A", "opponent": "DEN", "game_won": false, "player_team_score": "10", "opponent_score": "29", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 0, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 1, "kick_return_yards": 22, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2015", "game_id": "201511150gnb", "date": "2015-11-15", "game_number": "9", "age": "24.333", "team": "GNB", "game_location": "H", "opponent": "DET", "game_won": false, "player_team_score": "16", "opponent_score": "18", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 7, "receiving_receptions": 4, "receiving_yards": 57, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2015", "game_id": "201512030det", "date": "2015-12-03", "game_number": "12", "age": "24.351", "team": "GNB", "game_location": "A", "opponent": "DET", "game_won": true, "player_team_score": "27", "opponent_score": "23", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 3, "receiving_receptions": 1, "receiving_yards": 16, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2015", "game_id": "201512130gnb", "date": "2015-12-13", "game_number": "13", "age": "24.361", "team": "GNB", "game_location": "H", "opponent": "DAL", "game_won": true, "player_team_score": "28", "opponent_score": "7", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 1, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2015", "game_id": "201512200rai", "date": "2015-12-20", "game_number": "14", "age": "25.003", "team": "GNB", "game_location": "A", "opponent": "OAK", "game_won": true, "player_team_score": "30", "opponent_score": "20", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 3, "receiving_receptions": 3, "receiving_yards": 33, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2015", "game_id": "201512270crd", "date": "2015-12-27", "game_number": "15", "age": "25.010", "team": "GNB", "game_location": "A", "opponent": "ARI", "game_won": false, "player_team_score": "8", "opponent_score": "38", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 2, "receiving_receptions": 1, "receiving_yards": 5, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2015", "game_id": "201601030gnb", "date": "2016-01-03", "game_number": "16", "age": "25.017", "team": "GNB", "game_location": "H", "opponent": "MIN", "game_won": false, "player_team_score": "13", "opponent_score": "20", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 0, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2015", "game_id": "201601100was", "date": "2016-01-10", "game_number": "17", "age": "25.024", "team": "GNB", "game_location": "A", "opponent": "WAS", "game_won": true, "player_team_score": "35", "opponent_score": "18", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 4, "receiving_receptions": 2, "receiving_yards": 14, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2015", "game_id": "201601160crd", "date": "2016-01-16", "game_number": "18", "age": "25.030", "team": "GNB", "game_location": "A", "opponent": "ARI", "game_won": false, "player_team_score": "20", "opponent_score": "26", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 12, "receiving_receptions": 4, "receiving_yards": 55, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2016", "game_id": "201609110jax", "date": "2016-09-11", "game_number": "1", "age": "25.269", "team": "GNB", "game_location": "A", "opponent": "JAX", "game_won": true, "player_team_score": "27", "opponent_score": "23", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 1, "receiving_receptions": 1, "receiving_yards": 8, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2016", "game_id": "201609180min", "date": "2016-09-18", "game_number": "2", "age": "25.276", "team": "GNB", "game_location": "A", "opponent": "MIN", "game_won": false, "player_team_score": "14", "opponent_score": "17", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 0, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2016", "game_id": "201609250gnb", "date": "2016-09-25", "game_number": "3", "age": "25.283", "team": "GNB", "game_location": "H", "opponent": "DET", "game_won": true, "player_team_score": "34", "opponent_score": "27", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 0, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2016", "game_id": "201610090gnb", "date": "2016-10-09", "game_number": "4", "age": "25.297", "team": "GNB", "game_location": "H", "opponent": "NYG", "game_won": true, "player_team_score": "23", "opponent_score": "16", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 0, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2016", "game_id": "201610160gnb", "date": "2016-10-16", "game_number": "5", "age": "25.304", "team": "GNB", "game_location": "H", "opponent": "DAL", "game_won": false, "player_team_score": "16", "opponent_score": "30", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 1, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2017", "game_id": "201709240det", "date": "2017-09-24", "game_number": "3", "age": "26.281", "team": "DET", "game_location": "H", "opponent": "ATL", "game_won": false, "player_team_score": "26", "opponent_score": "30", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 0, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2017", "game_id": "201710010min", "date": "2017-10-01", "game_number": "4", "age": "26.288", "team": "DET", "game_location": "A", "opponent": "MIN", "game_won": true, "player_team_score": "14", "opponent_score": "7", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 0, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2017", "game_id": "201710080det", "date": "2017-10-08", "game_number": "5", "age": "26.295", "team": "DET", "game_location": "H", "opponent": "CAR", "game_won": false, "player_team_score": "24", "opponent_score": "27", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 3, "receiving_receptions": 2, "receiving_yards": 37, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2017", "game_id": "201710150nor", "date": "2017-10-15", "game_number": "6", "age": "26.302", "team": "DET", "game_location": "A", "opponent": "NOR", "game_won": false, "player_team_score": "38", "opponent_score": "52", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 4, "receiving_receptions": 1, "receiving_yards": 7, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, "defense_safeties": 0, "point_after_attemps": 0, "point_after_makes": 0, "field_goal_attempts": 0, "field_goal_makes": 0, "punting_attempts": 0, "punting_yards": 0, "punting_blocked": 0}, {"player_id": 5, "year": "2017", "game_id": "201710290det", "date": "2017-10-29", "game_number": "7", "age": "26.316", "team": "DET", "game_location": "H", "opponent": "PIT", "game_won": false, "player_team_score": "15", "opponent_score": "20", "passing_attempts": 0, "passing_completions": 0, "passing_yards": 0, "passing_rating": 0, "passing_touchdowns": 0, "passing_interceptions": 0, "passing_sacks": 0, "passing_sacks_yards_lost": 0, "rushing_attempts": 0, "rushing_yards": 0, "rushing_touchdowns": 0, "receiving_targets": 0, "receiving_receptions": 0, "receiving_yards": 0, "receiving_touchdowns": 0, "kick_return_attempts": 0, "kick_return_yards": 0, "kick_return_touchdowns": 0, "punt_return_attempts": 0, "punt_return_yards": 0, "punt_return_touchdowns": 0, "defense_sacks": 0, "defense_tackles": 0, "defense_tackle_assists": 0, "defense_interceptions": 0, "defense_interception_yards": 0, "defense_interception_touchdowns": 0, }]

Tags: idgamereturnplayerdefensekickattemptspassing
1条回答
网友
1楼 · 发布于 2024-10-01 05:03:13

一个(或多个)JSON文件的格式不好,代码缺乏错误处理能力,无法告诉您是哪一个。你知道吗

指望你用手去查5000个错误是不合理的。因此,请添加一些错误处理,在异常消息中包含文件名:

for f in glob.glob("*.json"):
    with open(f, "rb") as infile:
        try:
            result.append(json.load(infile))
        except json.decoder.JSONDecodeError as err:
            raise ValueError("JSON error decoding file '{0}': '{1}'".format(f, err))

如果有很多无效的JSON文件,您可以用print("...")替换raise ValueError("...");您的程序仍然无法处理这些文件,但它至少会列出所有这些文件。你知道吗

相关问题 更多 >