i have been reading page convert python list of strings floats, list contains words
and tried implement can't double list.
i have double list looks this
positions = [['ace','first', '10','-29'],['best','second','200','-10']] this opening file. remove strings 2nd , 3rd index spots in list both these positions integers , not strings. there way can open file mp remove these strings
or
is there way can remove strings applying method double list??
get list of lists, each sublist has int represented in last 2 positions of each sublist in positions:
[[int(i) in l[-2:]] l in positions] turn string representations of integers in positions ints:
[[int(i) in l if ((i.startswith('-') , all(char.isdigit() char in i)) or all(char.isdigit() char in i) else i] l in positions]
Comments
Post a Comment