Closed yrahul3910 closed 1 year ago
One use case is counting the number of lines in a file containing an expression. Currently, the solution is:
import glob for file in glob.glob('*.out'): count = `grep Running {file} | wc -l`.split()[0] print(f'{file} has {count} lines')
However, a better solution might be a full-Shell solution:
import glob for file in glob.glob('*.out'): count = `grep Running {file} | wc -l | awk "{print $1}"` print(f'{file} has {count} lines')
Currently, the curly braces are recognized as part of an f-string as part of its transpiling.
Please use the Python 3 f-string syntax for escaping:
count = int`grep Running {file} | wc -l | awk "{{print $1}}"`
One use case is counting the number of lines in a file containing an expression. Currently, the solution is:
However, a better solution might be a full-Shell solution:
Currently, the curly braces are recognized as part of an f-string as part of its transpiling.