第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何從字符串中刪除某些數(shù)據(jù)?

如何從字符串中刪除某些數(shù)據(jù)?

白板的微信 2023-06-20 10:24:30
此代碼輸出特定馬匹的時(shí)間戳和賠率。我想從代碼的輸出中刪除時(shí)間戳。我的代碼:request2 = requests.get('https://www.punters.com.au/api/web/public/Odds/getOddsComparisonCacheable/?allowGet=true&APIKey=65d5a3e79fcd603b3845f0dc7c2437f0&eventId=1045618&betType=FixedWin', headers={'User-Agent': 'Mozilla/5.0'})json2 = request2.json()for selection in json2['selections']:    for fluc in selection['flucs'][0]:        data = ast.literal_eval(selection['flucs'])        print(data[-2:])代碼輸出:[[1598060018, 12.97], [1598060095, 13.13]][[1598060066, 4.41], [1598060095, 4.36]][[1598060030, 2.11], [1598060095, 2.12]][[1598060030, 5.69], [1598060095, 5.61]][[1598059986, 16.35], [1598060095, 16.6]][[1598060006, 12.06], [1598060095, 12.35]][[1598060026, 25.83], [1598060095, 26.25]][[1598060026, 39.25], [1598060095, 39.83]]代碼的期望輸出:[[12.97], [13.13]][[4.41], [4.36]][[2.11], [2.12]]
查看完整描述

2 回答

?
慕碼人2483693

TA貢獻(xiàn)1860條經(jīng)驗(yàn) 獲得超9個(gè)贊

以下


data = [[1598060018, 12.97], [1598060095, 13.13]]

new_data = [[x[1]] for x in data]

print(new_data)

輸出


[[12.97], [13.13]]


查看完整回答
反對(duì) 回復(fù) 2023-06-20
?
MYYA

TA貢獻(xiàn)1868條經(jīng)驗(yàn) 獲得超4個(gè)贊

for lsst in new data:

    a=[str(item) for item in lsst if "." not in lsst]

或者


if type==float:

    "keep it"

else:

    "remove .. delete whatever"


查看完整回答
反對(duì) 回復(fù) 2023-06-20
  • 2 回答
  • 0 關(guān)注
  • 165 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)