我有一个列表列表,例如:
[['c', '2', '3', '4', 'd', '1'], ['e', '14', '16', '18', 'f', '1'], etc.]
Run Code Online (Sandbox Code Playgroud)
它们都遵循相同的模式(一个字符串,三个数字字符串,一个字符串,一个数字字符串)。我想将所有数字字符串都转换为整数,但这样做有困难。
I have tried an exception loop, which doesn't seem to be working (I'm not sure why). I know its targeting the sublists as originally I got a value error of int() doesn't recognise base 10 'c' (the first letter in the first element of the sublist.
[['c', '2', '3', '4', 'd', '1'], ['e', '14', '16', '18', 'f', '1'], etc.]
Run Code Online (Sandbox Code Playgroud)
When I print the results with …