首页 > 编程语言 > 详细

python之函数用法execfile()

时间:2015-11-07 18:52:00      阅读:278      评论:0      收藏:0      [点我收藏+]
# -*- coding: utf-8 -*-
#python 27
#xiaodeng
#python之函数用法execfile()



#execfile()
#说明:用来执行一个文件,相对于双击的效果
‘‘‘
execfile(...)
    execfile(filename[, globals[, locals]])
    filename:文件名
    globals:全局变量--这里指绝对路径
    locals:本地变量--这里指相对路径
    
    Read and execute a Python script from a file.
    The globals and locals are dictionaries, defaulting to the current
    globals and locals.  If only globals is given, locals defaults to it.
‘‘‘


#案例
#import chardet
filename=rmy.py
#print chardet.detect(filename)#ascii
#filename=r‘my.py‘.decode(‘ascii‘)
execfile(filename)

 

python之函数用法execfile()

原文:http://www.cnblogs.com/dengyg200891/p/4945723.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!