本文整理匯總了Python中cdo.Cdo.cleanTempDir方法的典型用法代碼示例。如果您正苦於以下問題:Python Cdo.cleanTempDir方法的具體用法?Python Cdo.cleanTempDir怎麽用?Python Cdo.cleanTempDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cdo.Cdo
的用法示例。
在下文中一共展示了Cdo.cleanTempDir方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testTempdir
# 需要導入模塊: from cdo import Cdo [as 別名]
# 或者: from cdo.Cdo import cleanTempDir [as 別名]
def testTempdir(self):
# manual set path
tempPath = os.path.abspath('.')+'/tempPy_{0}'.format( random.randrange(1,100000))
cdo = Cdo(tempdir=tempPath)
cdo.topo('r10x10',options = '-f nc')
self.assertEqual(1,len(os.listdir(tempPath)))
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
self.assertEqual(3,len(os.listdir(tempPath)))
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
self.assertEqual(5,len(os.listdir(tempPath)))
cdo.cleanTempDir()
self.assertEqual(0,len(os.listdir(tempPath)))
示例2: test_system_tempdir
# 需要導入模塊: from cdo import Cdo [as 別名]
# 或者: from cdo.Cdo import cleanTempDir [as 別名]
def test_system_tempdir(self):
# automatic path
tempPath = tempfile.gettempdir()
cdo = Cdo()
cdo.topo('r10x10',options = '-f nc')
self.assertEqual(1,len([ f for f in os.listdir(tempPath) if 'cdoPy' in f]))
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
self.assertEqual(3,len([ f for f in os.listdir(tempPath) if 'cdoPy' in f]))
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
self.assertEqual(12,len([ f for f in os.listdir(tempPath) if 'cdoPy' in f]))
cdo.cleanTempDir()
self.assertEqual(0,len([ f for f in os.listdir(tempPath) if 'cdoPy' in f]))