Percent Sign At The End Of The Output Of Python Script
Why is a percent sign at the end of the output of the python script? $ echo 'TEST TEST' | trim TESTTEST% #!/usr/bin/env python import sys if __name__ == '__main__': for lin
Solution 1:
The %
you see there might actually be your shell prompt, and not part of your program output. You're not writing a new line after your output, so the shell prompt appears at the very end of the output of the last command.
Possible solutions:
- Use
print
instead ofsys.stdout.write
- Append a newline to the end of the output with
+ "\n"
- Add a
print()
to the end of your program
Post a Comment for "Percent Sign At The End Of The Output Of Python Script"