keshun 当前离线
六级士官
with open("1.txt", "r") as f: msg = f.readlines()[0]print(msg)COPY
ivor 当前离线
上校
with open("1.txt", "r") as f: msg = f.readlines()[0].split() my_d = {} for i in msg: my_d[i.split(':')[0]]=i.split(':')[1]print(my_d['C'])print(my_d['F'])COPY
评分人数
TOP
netdzb 当前离线
上尉
Gin_Q 当前离线
五级士官
>>> a 'A:XRP B:-36.15% C:0.1866 D:-32.39% E:-59.08% F:0.41% G:-33.01%'>>> b=a.split() >>> b[2].split(':') ['C', '0.1866']>>> b[5].split(':') ['F', '0.41%']COPY
>>> a'A:XRP B:-36.15% C:0.1866 D:-32.39% E:-59.08% F:0.41% G:-33.01%'>>> d=re.compile('[CF]:(\d+.?\d+%?)')>>> d.findall(a)['0.1866', '0.41%']COPY