码迷,mamicode.com
首页 > 编程语言 > 详细

python 归纳 (一)_python组织方式

时间:2018-08-30 02:02:32      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:col   class   pre   对象   span   输出   sel   strong   object   

结论:

xxx.yyyy
yyyy 可以是 类、类对象、函数、变量
xxx  可以是 包、模块、类

代码:

ref1.py

# -*- coding: utf-8 -*-
import os

class abccc(object):
    def f(self,a):
        print a
c = abccc
d = abccc()
e = 5
def f(a):
    print "aa" + a

test1.py

# -*- coding: utf-8 -*-
"""
xxx.yyyy
yyyy 可以是 类、类对象、函数、变量
xxx  可以是 包、模块、类
"""
import  ref1

print type(ref1.abccc)
print ref1.e
ref1.f("6")

ref1.d.f("8")

e = ref1.c()
print type(e)
print type(ref1.e)
e.f("dd")

输出:

<type type>
5
aa6
8
<class ref1.abccc>
<type int>
dd

后续 :

验证 xxx 是否可以 函数、方法

 

推测:

zzzzz.xxx.yyyy(_,_,..)
xxx 可以是 包、模块、类、类对象
? 函数

python 归纳 (一)_python组织方式

标签:col   class   pre   对象   span   输出   sel   strong   object   

原文地址:https://www.cnblogs.com/sunzebo/p/9557688.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!