括号内的For / Loop会导致语法错误?

时间:2018-08-14 07:02:06

标签: python

“在帐户中的帐户”循环中收到无效的语法错误,为什么?

请帮助,我已经为此苦苦挣扎

app.send(
    functions.channels.InviteToChannel(
        channel=app.resolve_peer("xyz123"), 
        users=[
            for account in accounts:
                app.resolve_peer(accounts)
        ]
    )
)

1 个答案:

答案 0 :(得分:2)

您要使用list comprehension

app.send(
    functions.channels.InviteToChannel(
        channel=app.resolve_peer("xyz123"), 
        users=[
            app.resolve_peer(account) for account in accounts     
        ]
    )
)