Skip to content
Advertisement

E501 line too long (99 > 79 characters)

I execute a linux shell command using python.

I get the below error for the line mentioned-

E501 line too long (99 > 79 characters)

Code:

 ssh_client.exec_command(
            "sudo grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage}'")

Im not sure how to format the line as its a Linux command.

Advertisement

Answer

Consecutive string literals (separated only by whitespace) are merged into one in Python. So:

ssh_client.exec_command(
    "sudo grep 'cpu ' /proc/stat | "
    "awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage}'")
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement