有一個在我的python腳本的一部分,我收到此錯誤:轉換一個STR爲float(python34)
類型錯誤:不支持的操作數類型(S)爲+: '浮動' 和 'STR'
代碼:
for proj in data['daily_projections']:
proj['nba_player_id'] = float(proj['nba_player_id'])
print(proj['fanduel_fp'] + ' ' + proj['nba_player_id'])
這是我目前已經和它不能正常工作。
'PROJ [' fanduel_fp ']' 是浮動和 '凸出[' nba_player_id ']' 是我需要轉換爲float字符串
你可能想的正好相反:以打印使用'str'轉換爲字符串。 – 2015-02-05 16:06:26