Some manual .format() -> f-strings

This commit is contained in:
Anthony Sottile 2020-01-12 11:13:39 -08:00
parent aefbe71765
commit 9000e9dd41
27 changed files with 133 additions and 173 deletions

View file

@ -1,13 +1,7 @@
#!/usr/bin/env python
import sys
def main():
for i in range(6):
f = sys.stdout if i % 2 == 0 else sys.stderr
f.write(f'{i}\n')
f.flush()
if __name__ == '__main__':
exit(main())
#!/usr/bin/env bash
echo 0
echo 1 1>&2
echo 2
echo 3 1>&2
echo 4
echo 5 1>&2

View file

@ -1,12 +1,11 @@
#!/usr/bin/env python
import sys
def main():
print('stdin: {}'.format(sys.stdin.isatty()))
print('stdout: {}'.format(sys.stdout.isatty()))
print('stderr: {}'.format(sys.stderr.isatty()))
if __name__ == '__main__':
exit(main())
#!/usr/bin/env bash
t() {
if [ -t "$1" ]; then
echo "$2: True"
else
echo "$2: False"
fi
}
t 0 stdin
t 1 stdout
t 2 stderr