def main(): print([ITEM FOR ITEM IN OS.LISTDIR('.') if item.endswith('.py')]); print( sys.version)
if __name__ == __main__: main() [root@bya Test_Project]# pycodestyle --show-source test.py # 使用 --show-source 显示出错源码 test.py:1:10: E231 missing whitespace after ',' import os,sys ^ test.py:1:10: E401 multiple imports on one line import os,sys ^ test.py:3:1: E302 expected 2 blank lines, found 1 def main(): ^ test.py:4:70: E703 statement ends with a semicolon print([ITEM FOR ITEM IN OS.LISTDIR('.') if item.endswith('.py')]); ^ test.py:5:11: E201 whitespace after '(' print( sys.version) ^ test.py:7:1: E305 expected 2 blank lines after class or function definition, found 1 if __name__ == __main__: ^ [root@bya Test_Project]#
Some useful pyenv commands are: commands List all available pyenv commands exec Run an executable with the selected Python version global Set or show the global Python version(s) help Display help for a command hooks List hook scripts for a given pyenv command init Configure the shell environment for pyenv install Install a Python version using python-build local Set or show the local application-specific Python version(s) prefix Display prefix for a Python version rehash Rehash pyenv shims (run this after installing executables) root Display the root directory where versions and shims are kept shell Set or show the shell-specific Python version shims List existing pyenv shims uninstall Uninstall a specific Python version version Show the current Python version(s) and its origin --version Display the version of pyenv version-file Detect the file that sets the current pyenv version version-name Show the current Python version version-origin Explain how the current Python version is set versions List all Python versions available to pyenv whence List all Python versions that contain the given executable which Display the full path to an executable
See `pyenv help <command>' for information on a specific command. For full documentation, see: https://github.com/pyenv/pyenv#readme [root@bya Test_Project]#