zoukankan      html  css  js  c++  java
  • python 导出函数

    [root@node01 python]# pwd
    /root/python
    
    
    [root@node01 python]# cat lib/pycharm/myutils.py
    def scanner(a,b):
        for line in a:
            b(line)
    
    
    [root@node01 python]# cat a4.py 
    from lib.pycharm.myutils import *
    f=open('/etc/passwd','r')
    def linehandler(x):
       print len(x)
    print scanner(f,linehandler)
    [root@node01 python]# python a4.py 
    32
    33
    40
    37
    41
    32
    45
    33
    47
    48
    45
    46
    48
    44
    38
    48
    61
    60
    40
    60
    70
    45
    36
    69
    50
    67
    33
    90
    35
    35
    48
    70
    80
    40
    41
    37
    68
    45
    40
    36
    None

  • 相关阅读:
    awk
    tac
    cat
    less
    more
    head
    vim
    linux安装redis
    Redis for Python开发手册
    Python3.x标准模块库目录
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349473.html
Copyright © 2011-2022 走看看