# -*- coding: utf-8 -*-
#python 27
#xiaodeng
#Python学习手册 633
#模块是对象:元程序
#因为模块通过内置属性显示了他们的大多数特性,因此很容易编写程序来管理其他程序,我们称这类管理程序为元程序。我们在其他系统之上工作 #元程序
#编写一个程序,能够操纵改变其他程序,这叫元程序。 #test模块
#test.py
# -*- coding: utf-8 -*-
#python 27
#xiaodeng
_x='xiaodeng'
name='python' def func():
print 'def' #查找name的属性
import test,sys
print test.name #python
print test.__dict__['name'] #python,可以理解为__dict__返回的是一个dict形式,而__dict__['name']就是取dict的值(value)
print getattr(test,'name') #python 比较顶层的概念和用法 print sys.modules['test']#<module 'test' from 'C:\Users\Administrator\Desktop\test.pyc'>
print sys.modules['test'].name #python

元程序 /如何取test.py中name的值的更多相关文章

  1. 【Python】如何取到input中的value值?

    练习:取到下方链接下所有海贼王的下载链接. # coding=utf-8 from selenium import webdriver from time import sleep import ke ...

  2. oracle分组后取某组中最大的值

    查询username,根据fundcode分组,按照date倒序,取date最大的一条数据 select * from ( select username, row_number() over(par ...

  3. py中变量名的“秘密”

    今天突然脑子发抽,想到py里有没有指针这个概念,于是我马上google.baidu了一波,发现网上大多都在说py.java.c#这类纯面向对象的编程语言用对象的概念能完全替代指针.那么问题来了,没有指 ...

  4. [转载] C++11中的右值引用

    C++11中的右值引用 May 18, 2015 移动构造函数 C++98中的左值和右值 C++11右值引用和移动语义 强制移动语义std::move() 右值引用和右值的关系 完美转发 引用折叠推导 ...

  5. C++11中的右值引用

    原文出处:http://kuring.me/post/cpp11_right_reference May 18, 2015 移动构造函数 C++98中的左值和右值 C++11右值引用和移动语义 强制移 ...

  6. Py中的多维数组ndarray学习【转载】

    转自:http://blog.sciencenet.cn/home.php?mod=space&uid=3031432&do=blog&id=1064033 1. NumPy中 ...

  7. Django 中 如何使用 settings.py 中的常量

    在用django 框架开发 python web 程序的时候 , 在模板页面经常会用到 settings.py 中设置的常量,比如MEDIA_URL, 我尝试过在模板页面用类似如下的方式 程序代码 { ...

  8. ListView与.FindControl()方法的简单练习 #2 -- ItemUpdting事件中抓取「修改后」的值

    原文出處  http://www.dotblogs.com.tw/mis2000lab/archive/2013/06/24/listview_itemupdating_findcontrol_201 ...

  9. 用正则表达式抓取网页中的ul 和 li标签中最终的值!

                获取你要抓取的页面 const string URL = "http://www.hn3ddf.gov.cn/price/GetList.html?pageno=1& ...

随机推荐

  1. C# 去掉webapi返回json所带的转义字符

    反序列换报错: {"Error converting value \"{\"Result\":true,\"Code\":\"\& ...

  2. .NET泛型03,泛型类型的转换,协变和逆变

    协变(Convariant)和逆变(Contravariant)的出现,使数组.委托.泛型类型的隐式转换变得可能. 子类转换成基类,称之为协变:基类转换成子类,称之为逆变..NET4.0以来,支持了泛 ...

  3. Google Admob广告Android全攻略1

    一.登录Google AdMob中文官网:http://www.google.cn/ads/admob/   ,注册帐号. 1.点击注册AdMob帐号 2.进入Google帐号注册页面,因为要创建一个 ...

  4. 在Windows下编译Emacs

    在Windows下编译Emacs Windows下编译好的Emacs主要有两个版本,一个来自http://nqmacs.sourceforge.net/,另一个来自http://www.crasseu ...

  5. UITableView的headerView展开缩放动画

    UITableView的headerView展开缩放动画 效果 源码 https://github.com/YouXianMing/Animations // // HeaderViewTapAnim ...

  6. [翻译] AnimatedPath 动画路径(持续更新)

    AnimatedPath动画路径 感谢原作者分享精神,有空补上使用教程 https://github.com/twotoasters/AnimatedPath AnimatedPath explore ...

  7. Derby设置密码教程

    方法一:    配置derby.propertites文件: 文件内容: derby.connection.requireAuthentication=truederby.authentication ...

  8. noise_process.c

    #include <math.h>#include "otdr_const.h"#include "haar.h"#include "ot ...

  9. NFS CIFS SAMBA 的联系和区别

    Common Internet File System, CIFS Server Message Block, SMB Network File System, NFS 在早期网络世界当中,档案数据在 ...

  10. Java并发学习之十五——使用读写锁同步数据訪问

    本文是学习网络上的文章时的总结.感谢大家无私的分享. 读写锁重要的是写锁的使用,仅仅用一个入口. 以下是读写锁使用的样例 package chapter2; import java.util.conc ...