python之函数用法execfile(),,# -*- codi


# -*- 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 chardetfilename=r‘my.py‘#print chardet.detect(filename)#ascii#filename=r‘my.py‘.decode(‘ascii‘)execfile(filename)

python之函数用法execfile()

相关内容

    暂无相关文章

评论关闭