You have two options:
Nest your list comprehension:
[[ord(c) for c in nested[0]] for nested in outerlist]
In Python 3, you can encode the string to a bytes
object, and convert that to a list. bytes
objects are just sequences of integers, after all:
[list(nested[0].encode('ascii')) for nested in outerlist]
The Python 2 equivalent is to use the bytearray()
type; for str
(byte strings):
[list(bytearray(nested[0])) for nested in outerlist]
In both cases I assume that your nested list contain just a single element each, a string.
Demo on Python 3.7:
>>> l = [['You '], ['have '], ['made '], ['my '], ['day.']]
>>> [[ord(c) for c in nested[0]] for nested in l]
[[89, 111, 117, 32], [104, 97, 118, 101, 32], [109, 97, 100, 101, 32], [109, 121, 32], [100, 97, 121, 46]]
>>> [list(nested[0].encode('ascii')) for nested in l]
[[89, 111, 117, 32], [104, 97, 118, 101, 32], [109, 97, 100, 101, 32], [109, 121, 32], [100, 97, 121, 46]]