当前位置: 首页>>代码示例>>Python>>正文


Python FileIO.write方法代码示例

本文整理汇总了Python中FileIO.write方法的典型用法代码示例。如果您正苦于以下问题:Python FileIO.write方法的具体用法?Python FileIO.write怎么用?Python FileIO.write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileIO的用法示例。


在下文中一共展示了FileIO.write方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: FileIO_test

# 需要导入模块: import FileIO [as 别名]
# 或者: from FileIO import write [as 别名]
def FileIO_test():

	data ="1\n2\n3\n4\n"

	rt = FileIO.write('WRITE_TEST', data, 'w') 
	assert(rt == 0)


	c_list = []
	(rt, c_list) = File.read("WRITE_TEST", 3)
	assert(rt == 0)
	assert(len(c_list) == 3)

	# 0 이면 all line -> list 로
	(rt, c_list) = FileIO.read("WRITE_TEST", 0)
	assert(rt == 0)
	assert(len(c_list) == 4)

	list = []
	list.append('AA')
	list.append('BB')

	rt = FileIO.write('TEST01', list)
	assert(rt == 0)

	(rt, c_list) = FileIO.read("TEST01", 2)

	assert(rt == 0)
	assert(len(c_list) == 2)



	return
开发者ID:iloveaired,项目名称:nbviewer,代码行数:35,代码来源:lib_test.py

示例2: login

# 需要导入模块: import FileIO [as 别名]
# 或者: from FileIO import write [as 别名]
def login(home_path, today, file_write = 0):
	try :



		(ok, login_l, other_l) =  login_list(os.path.join(home_path,'.ac_info'))

		if not ok : return (0, home_path + '  ' + l)

		#(1, [('20051010', '20051010'), ('20051012', '20051015')], [])

		(ok, r) = _login(login_l, today)

		if not ok : 
			return (0, r)

		login_l2 =  login_format(r)

		reply = join_list(login_l2, other_l)

		i = len(login_l2) - len(login_l)
		log  = '%s %d  row added' % ( os.path.join(home_path,'.ac_info'), i)

		if( not os.path.exists(home_path)) : 
			return (0, reply, home_path + ' not exists') 

		if (file_write) :
			FileIO.write(os.path.join(home_path,'.ac_info'), reply)
			
		return (1, reply, log)
		
	except :
		t, v, tb = sys.exc_info()
		print 'login exception... (%s:%s)' % (t, v)
		return (0, log , log)
开发者ID:iloveaired,项目名称:nbviewer,代码行数:37,代码来源:AQUtil.py

示例3: writeCustomToFile

# 需要导入模块: import FileIO [as 别名]
# 或者: from FileIO import write [as 别名]
def writeCustomToFile(customPrograms, customName):
    '''Store custom application information'''
    tempDir = tempfile.gettempdir()
    tempLocation = os.path.join(tempDir,'AssetManagerTemp')
    tempLocation = os.path.join(tempLocation,'CustomMenuItems.ini')    
    data = '#Custom Application:'
    section = ['CustomPrograms', 'CustomName']
    key = ['Programs', '\n', 'Names']
    value = []
    for item in customPrograms:
        value.append(item)
    value.append('\n')
    for item in customName:
        value.append(item)
    data = FileIO.build(data, section, key, value)
    FileIO.write(data, tempLocation)
开发者ID:burninghelix123,项目名称:AssetManager,代码行数:18,代码来源:OpenAsset.py

示例4: touch_ktf_notify

# 需要导入模块: import FileIO [as 别名]
# 或者: from FileIO import write [as 别名]
def touch_ktf_notify(t) :
	try :
		(id, level , s_type, email_list) = t
		ok , path =  home_fullpath(id)

		if not os.path.exists(path) : DirUtil.make_dirs(path)  

		l = []
		l.append("level=" + level + "&type=" + s_type)
		for email in email_list :
			l.append(email)

		l.sort()

		FileIO.write(os.path.join(path, '.ktf_notify'), l)

		return (1, os.path.join(path, '.ktf_notify'))

	except :
		t, v, tb = sys.exc_info()
		log = 'touch_ktf_notify(%s:%s)' % (t, v)
		return (0, log)
开发者ID:iloveaired,项目名称:nbviewer,代码行数:24,代码来源:KTFUtil.py


注:本文中的FileIO.write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。