ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

jython查看帮助help和模块modules

2021-11-01 08:33:40  阅读:198  来源: 互联网

标签:__ jython .__ help modules encodings


jython运行环境是需要JAVA支持的,JAVA安装百度很多。

 

查看JAVA是否安装成功:

[root@node ~]# java -version
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)

 

下载好jython包,进入到jython的jar包目录里:

[root@node2 win-share]# cd ~/jython/
[root@node2 win-share]# ls -l
-rwxrwxrwx. 1 root root  43056592 10月 31 20:51 jython-standalone-2.7.2.jar

 

jython有两种一种是包名上带“installer”字样的,代表是安装版;另一种是包名带“standalone”字样的,就可以直接用JAVA启动

这里以第二种standalone”字样举例

[root@node2 win-share]# cd ~/jython/
[root@node2 win-share]# java -jar jython-standalone-2.7.2.jar

  输入等待启动,启动后就和Python一样会出现“>>>”

进入帮助函数:

>>> help()

Welcome to Python 2.7!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/2.7/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help>

  看到help> ,已经就是进入帮助了。

 

查看jar包里有多少个模块:

help> modules

Please wait a moment while I gather a list of all available modules...

BaseHTTPServer      cmath               javapath            runpy
CGIHTTPServer       cmd                 javashell           sax
ConfigParser        code                jffi                sched
Cookie              codecs              json                select
DocXMLRPCServer     codeop              jythonlib           sets
HTMLParser          collections         keyword             sgmllib
MimeWriter          colorsys            lib2to3             sha
Queue               command             linecache           shelve
SimpleHTTPServer    commands            locale              shlex
SimpleXMLRPCServer  compileall          logging             shutil
SocketServer        compiler            macpath             signal
StringIO            contextlib          macurl2path         site
UserDict            cookielib           mailbox             smtpd
UserList            copy                mailcap             smtplib
UserString          copy_reg            markupbase          sndhdr
_LWPCookieJar       crypt               marshal             socket
_MozillaCookieJar   csv                 math                sre
__builtin__         ctypes              md5                 sre_compile
__future__          datetime            mhlib               sre_constants
_abcoll             dbexts              mime                sre_parse
_ast                decimal             mimetools           ssl
_bytecodetools      difflib             mimetypes           stat
_codecs             dircache            mimify              string
_collections        dis                 modjy               struct
_csv                distutils           multifile           subprocess
_fix_jython_setuptools_osx doctest             mutex               symbol
_fsum               dom                 netrc               synchronize
_functools          dumbdbm             new                 sys
_google_ipaddr_r234 dummy_thread        nntplib             sysconfig
_hashlib            dummy_threading     ntpath              tabnanny
_imp                email               nturl2path          tarfile
_io                 encodings           numbers             telnetlib
_json               ensurepip           opcode              tempfile
_jyio               errno               operator            test
_jythonlib          etree               optparse            tests
_locale             exceptions          os                  textwrap
_marshal            filecmp             parsers             this
_py_compile         fileinput           pawt                thread
_pyio               fixes               pdb                 threading
_random             fnmatch             pgen2               time
_rawffi             formatter           pickle              timeit
_socket             fpformat            pickletools         token
_sre                fractions           pipes               tokenize
_sslcerts           ftplib              pkgutil             trace
_strptime           functools           platform            traceback
_threading          future_builtins     plistlib            tty
_threading_local    gc                  popen2              types
_weakref            genericpath         poplib              ucnhash
_weakrefset         getopt              posix               unicodedata
abc                 getpass             posixfile           unittest
aifc                gettext             posixpath           urllib
anydbm              glob                pprint              urllib2
argparse            grp                 profile             urlparse
array               gzip                pstats              user
ast                 hashlib             pty                 uu
asynchat            heapq               pwd                 uuid
asyncore            hmac                py_compile          warnings
atexit              htmlentitydefs      pycimport           weakref
base64              htmllib             pyclbr              webbrowser
bdb                 httplib             pydoc               whichdb
binascii            ihooks              pydoc_data          wsgiref
binhex              imaplib             pyexpat             xdrlib
bisect              imghdr              quopri              xml
bz2                 imp                 random              xmllib
cPickle             importlib           re                  xmlrpclib
cStringIO           inspect             readline            zipfile
calendar            io                  repr                zipimport
cgi                 isql                rfc822              zlib
cgitb               itertools           rlcompleter         
chunk               jarray              robotparser 

****  以下内容略过 ****

 

查看模块具体使用方法:

help> encodings
Help on package encodings:

NAME
    encodings - Standard "encodings" Package

FILE
    /media/win-share-c/jython-standalone-2.7.2.jar/Lib/encodings/__init__.py

DESCRIPTION
        Standard Python encoding modules are stored in this package
        directory.
    
        Codec modules must have names corresponding to normalized encoding
        names as defined in the normalize_encoding() function below, e.g.
        'utf-8' must be implemented by the module 'utf_8.py'.
    
        Each codec module must export the following interface:
    
        * getregentry() -> codecs.CodecInfo object
        The getregentry() API must a CodecInfo object with encoder, decoder,
        incrementalencoder, incrementaldecoder, streamwriter and streamreader
        atttributes which adhere to the Python Codec Interface Standard.
    
        In addition, a module may optionally also define the following
        APIs which are then used by the package's codec search function:
    
        * getaliases() -> sequence of encoding name strings to use as aliases
    
        Alias names returned by getaliases() must be normalized encoding
        names as defined by normalize_encoding().
    
    Written by Marc-Andre Lemburg (mal@lemburg.com).
    
    (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.

**** 略过部分内容 ****

 

导入模块使用,输入部分后用Tab键显示全部函数(方法):

>>> import encodings
>>> encodings.
encodings.CodecRegistryError(     encodings.__builtin__             encodings.__doc__                 
encodings.__file__                encodings.__loader__              encodings.__name__                
encodings.__package__             encodings.__path__                encodings._aliases                
encodings._cache                  encodings._import_tail            encodings._java                   
encodings._norm_encoding_map      encodings._unknown                encodings.aliases                 
encodings.codecs                  encodings.hex_codec               encodings.idna                    
encodings.normalize_encoding(     encodings.search_function(        encodings.utf_8                   
encodings.__class__(              encodings.__delattr__(            encodings.__dict__                
encodings.__ensure_finalizer__(   encodings.__format__(             encodings.__getattribute__(       
encodings.__hash__(               encodings.__init__(               encodings.__new__(                
encodings.__reduce__(             encodings.__reduce_ex__(          encodings.__repr__(               
encodings.__setattr__(            encodings.__str__(                encodings.__subclasshook__(       

 

 

 

 

 

 

 

 

standalone

标签:__,jython,.__,help,modules,encodings
来源: https://www.cnblogs.com/wutou/p/15491924.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有