Код: Выделить всё
with open("/proc/mounts") as f:
mountpoints = (
[list((filter(lambda s: s.startswith("/t"), line.split(" "))))
for line in f if
(lambda l:
list(filter(lambda x: x.startswith("/t"), l))
)(line.split(" "))])
print(mountpoints)
#[['/tmp']]
#this is correct, however I want to remove one pair of brackets
print(*mountpoints)
#['/tmp']
#this works!
m = *mountpoints
#SyntaxError: can't use starred expression here
#but this doesn't.
В чем разница с оператором печати?
Подробнее здесь: https://stackoverflow.com/questions/648 ... expression
Мобильная версия