本文整理汇总了Python中six.print3函数的典型用法代码示例。如果您正苦于以下问题:Python print3函数的具体用法?Python print3怎么用?Python print3使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print3函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: sayResultMaybe
def sayResultMaybe( self, sResult, iSlot ):
#
from Time.Output import sayLocalTime
#
if self.bSayEachResult:
#
print3( '%s %s Slot %s' % ( sResult, sayLocalTime(), iSlot ) )
开发者ID:netvigator,项目名称:myPyPacks,代码行数:7,代码来源:wGet.py
示例2: _putErrorMsg
def _putErrorMsg( uTo, oExceptMsg, oTraceBack, sErrorFile, sMsg ):
#
from sys import exc_info
#
from Dir.Get import sTempDir
from File.Write import openAppendClose, QuickDump
from Time.Output import sayGMT
#
if sErrorFile is None:
#
print3( '*** message may not have been sent! ***' )
print3( uTo )
print3( oExceptMsg )
try:
oTraceBack.print_stack()
except AttributeError:
#
error, msg, traceback = exc_info()
#
print3( error, msg )
print3( dir( oTraceBack ) )
#
else:
#
sOut = '%s\n%s\n\n' % ( _getSayTo( uTo ), repr( oExceptMsg ) )
#
openAppendClose( sOut, sErrorFile, bSayBytes = False )
#
#
QuickDump( sMsg,
sTempDir, 'email_mime_%s.txt' % sayGMT( sBetween = '_' ),
bSayBytes = False )
开发者ID:netvigator,项目名称:myPyPacks,代码行数:32,代码来源:Send.py
示例3: sayTestResult
def sayTestResult( lProblems ):
#
from os import getcwd
from sys import argv
#
from six import print_ as print3
#
from Utils.ImIf import ImIf
#
if lProblems:
#
sFile = argv[0]
#
if sFile.startswith( './' ): sFile = sFile[ 2 : ]
#
t = ( sFile, getcwd() )
#
sWorkingOrNot = ImIf( sFile == 'Result.py', '', 'not ' )
#
sSay = '%%s in %%s is %sworking:' % sWorkingOrNot
#
lProblems[ 0 : 0 ] = [ sSay % t ]
#
print3( sep = '\n ', *lProblems )
#
else:
print3( 'OK!' )
开发者ID:netvigator,项目名称:myPyPacks,代码行数:27,代码来源:Result.py
示例4: fn_4
def fn_4(secs):
try:
time.sleep(secs)
return "Finished"
except TimeOverExcept:
print3( "(Caught TimeOverExcept, so cleaining up, and re-raising it) - ", end = '' )
raise TimeOverExcept
开发者ID:netvigator,项目名称:myPyPacks,代码行数:7,代码来源:TimeLimit.py
示例5: _getLinksSamples
def _getLinksSamples( oGetPages, sHTML, sURL, uThis, sTempFile, iSlot, oSuccess ):
#
"""
This is part of the demo.
"""
#
from Web.HTML import getLinksOffHTML
#
lLinks = getLinksOffHTML( sHTML, sURL, bKeepUrlDomains = False )
#
lEnvs = getRandoms( lLinks, oGetPages.iMax * 2 )
#
dMoHeaders = { 'Referer' : sURL }
#
sOrigURL = sURL
#
lEnvs = [ { 'sURL' : sURL,
'doWithSuccess' : _sayPageInfo,
'dMoHeaders' : dMoHeaders
} for sURL in lEnvs ]
#
if oGetPages.bSayEachResult:
#
sSayDuration = oGetPages.getSayDuration( sOrigURL )
#
print3( 'got %s links after %s, but will only investigate %s' %
( len( lLinks ), sSayDuration, len( lEnvs ) ) )
#
oGetPages.AppendOrExtend( lEnvs, iSlot )
开发者ID:netvigator,项目名称:myPyPacks,代码行数:29,代码来源:TwistedMethods.py
示例6: getBooleanInteger
def getBooleanInteger( uValue, bDebug = 1 ):
#
from six import print_ as print3
#
from String.Get import getContentOutOfQuotes
#
if _isNumber( uValue ):
#
iValue = int( bool( uValue ) )
#
else:
#
iValue = None
#
uValue = getContentOutOfQuotes( uValue ).lower()
#
if uValue in setBooleanTrue: iValue = 1
elif uValue in setBooleanFalse: iValue = 0
else:
if bDebug:
print3( uValue )
raise TypeError
#
#
return iValue
开发者ID:netvigator,项目名称:myPyPacks,代码行数:25,代码来源:Boolean.py
示例7: doDelete
def doDelete(
oCursor,
oDbApi,
sTable,
tWhereCols = None,
tWhereVals = None,
tWhereOper = None,
oValFormatter = None ):
#
from DbApi.Format import getTypeCaster
from DbApi.Query import getLimitClause
#
sWhere = ''
#
getTypeCastValue = getTypeCaster( oValFormatter )
#
if tWhereCols:
#
sWhere = getLimitClause(
sTable,
tWhereCols,
tWhereVals,
tWhereOper,
oDbApi = oDbApi,
getTypeCastValue = getTypeCastValue )
#
sDeleteStatement = 'delete from %s%s;' % ( sTable, sWhere )
#
try:
oCursor.execute( sDeleteStatement )
except:
print3( sDeleteStatement )
raise
#
return sDeleteStatement
开发者ID:netvigator,项目名称:myPyPacks,代码行数:35,代码来源:Update.py
示例8: getConfName4Host
def getConfName4Host( cBaseName, bVerbose = True ):
#
'''
pass the base name, like MyApp
say the hostname is Gertrude
This will look for MyApp-Gertrude.conf
'''
#
from socket import gethostname
#
from File.Test import isFileThere
#
sHostName = gethostname()
#
sLookForConf = "%s-%s.conf" % ( cBaseName, sHostName )
#
sLookForConf = _findConfFile( sLookForConf )
#
if not isFileThere( sLookForConf ):
#
if bVerbose: print3( ('Did not find config file: %s') % sLookForConf )
#
raise NoConfigFile
#
return sLookForConf
开发者ID:netvigator,项目名称:myPyPacks,代码行数:25,代码来源:Config.py
示例9: show_re
def show_re( sPattern, sString ):
#
"""
Try show_re( sPattern, sString ) to show what re matches.
"""
#
from six import print_ as print3
#
from re import compile as REcompile, MULTILINE
#
print3( '\n', REcompile( sPattern, MULTILINE ).sub("{\g<0>}", sString.rstrip() ) )
开发者ID:netvigator,项目名称:myPyPacks,代码行数:11,代码来源:Output.py
示例10: _sayPageInfo
def _sayPageInfo( oGetPages, sHTML, sURL, uThis, sTempFile, iSlot, oSuccess ):
#
"""
This is part of the demo.
"""
#
if oGetPages.bSayEachResult:
#
sSayDuration = oGetPages.getSayDuration( sURL )
#
print3( 'got %s bytes after %s' % ( ReadableNo( len( sHTML ) ), sSayDuration ) )
开发者ID:netvigator,项目名称:myPyPacks,代码行数:11,代码来源:TwistedMethods.py
示例11: getPageContent
def getPageContent(
sURL,
sReferrer = '',
bJavascript = False,
dMoHeaders = {} ):
#
from sys import stderr
from time import sleep
#
sContent = ''
#
dMoHeaders = {}
#
if sReferrer != '':
#
dMoHeaders.update( { 'Referer' : sURL } )
#
#
if bJavascript:
#
dMoHeaders.update( { 'accept' : 'text/javascript,' + dHEADERS[ 'accept' ] } )
#
#
dURL = { 'sURL' : sURL,
'doWithSuccess' : _getPageContent,
'doWithFailure' : _getErrorMessage,
'dMoHeaders' : dMoHeaders }
#
try:
oGetPages = \
getPagesClass(
uPages = [ dURL ],
bGetGoing = True,
bSayEachResult = True )
# uObservers = _demoObserver(),
#
#
except KeyboardInterrupt:
#
print3( "\n\nExiting on user cancel.", file = stderr )
#
#
while not oGetPages.bFinished:
#
sleep( 5 )
print3( 'not finished yet ...' )
#
#
if len( oGetPages.sHTML ) > len( oGetPages.sFail ):
sContent = oGetPages.sHTML
else:
sContent = oGetPages.sFail
#
return sContent
开发者ID:netvigator,项目名称:myPyPacks,代码行数:54,代码来源:wGet.py
示例12: getStarted
def getStarted( self ):
#
if not self.bFinished and not reactor.running and Any( self.lDownLoading ):
#
if self.bSayEachResult:
print3( 'Starting reactor ...' )
#
self.bReactorOn = True
#
self.statusChanged()
#
reactor.run()
开发者ID:netvigator,项目名称:myPyPacks,代码行数:12,代码来源:TwistedMethods.py
示例13: printError
def printError( oFailure ):
#
from sys import stderr
#
try:
sayError = getSayError( oFailure )
except:
sayError = 'getSayError() gave an error!'
#
print3( 'Error:', sayError, file=stderr )
#
reactor.stop()
开发者ID:netvigator,项目名称:myPyPacks,代码行数:12,代码来源:WebCat.py
示例14: main
def main( sChopDir ):
#
import time
#
sChopDir = getArgs( sChopDir )
#
if sChopDir is not None:
#
print3( 'Chopping file names...' )
#
iStart = time.time()
#
ChopNames( sChopDir )
开发者ID:netvigator,项目名称:myPyPacks,代码行数:13,代码来源:ChopDirs.py
示例15: ChopNames
def ChopNames( sChopDir ):
#
from os import listdir
from os.path import isfile, isdir, join, exists
#
from Collect.Query import get1stThatMeets
from Iter.AllVers import iFilter, tFilter, iMap, tMap
#
def WholeFileSpec( s ): return join( sChopDir, s )
#
tFiles = tFilter( isfile, tMap( WholeFileSpec, listdir( sChopDir ) ) )
#
if tFiles:
#
tNaExt = tMap( _getNaExtOffFullSpec, tFiles )
#
tNames = tMap( _getNameOffFullSpec, tFiles )
#
lExtns = tMap( _getExtnOffFullSpec, tFiles )
#
tNewNs = tMap( ChopOneName, tNames )
#
tNewNs = [ '%s%s' % (sN, sE ) for sN, sE in iZip( tNewNs, lExtns ) ]
#
setNew = frozenset( tNewNs )
#
if tNaExt == tuple( tNewNs ):
#
pass # print3( 'no name changes for', sChopDir
#
elif len( setNew ) == len( tNaExt ):
#
lPathNew = iMap( WholeFileSpec, tNewNs )
#
if get1stThatMeets( lPathNew, exists ):
#
RenameCarefully( sChopDir, tNames, lExtns, tNaExt, tNewNs )
#
else:
#
RenameAll( sChopDir, tNaExt, tNewNs )
#
#
elif len( setNew ) >= 0.9 * len( tNaExt ):
#
RenameCarefully( sChopDir, tNames, lExtns, tNaExt, tNewNs )
#
else:
#
print3( 'fail, in %s got %s orig and %s new' % \
( sChopDir, len( tNaExt ), len( setNew ) ) )
开发者ID:netvigator,项目名称:myPyPacks,代码行数:51,代码来源:ChopDirs.py
示例16: notifyObservers
def notifyObservers( self, dState = None ):
#
for oClient in self.lSubscribers:
#
try:
oClient.update( dState )
#
except ( StopIteration, GeneratorExit, KeyboardInterrupt, SystemExit ):
#
raise
#
except Exception: # StandardError
#
print3( 'got exception on running update(): %s' % str( oClient ) )
开发者ID:netvigator,项目名称:myPyPacks,代码行数:14,代码来源:Patterns.py
示例17: _AttributesFromKWArgsSpeedTest
def _AttributesFromKWArgsSpeedTest():
#
from six import print_ as print3
#
from Object.Get import ValueContainer
from Utils.TimeTrial import TimeTrial
#
print3( '\n_getsAttributesFromKWArgs' )
TimeTrial( _getsAttributesFromKWArgs,
a = 1, b = 2, c = 3 )
#
print3( '\nValueContainer' )
TimeTrial( ValueContainer,
a = 1, b = 2, c = 3 )
开发者ID:netvigator,项目名称:myPyPacks,代码行数:14,代码来源:Set.py
示例18: getMembersStripped
def getMembersStripped( tRow, lStripOrNot ):
#
from Iter.AllVers import iZip
#
try:
lStripRow = iZip( lStripOrNot, tRow )
except:
print3( lStripOrNot )
print3( tRow )
raise
#
lRow = [ _getStrippedMaybe( bStrip, uCell )
for bStrip, uCell in lStripRow ]
#
return tuple( lRow )
开发者ID:netvigator,项目名称:myPyPacks,代码行数:15,代码来源:Format.py
示例19: sayWhenNothingElse
def sayWhenNothingElse( self, sURL, iBytes, oFailure = None):
#
if self.bSayEachResult:
#
if oFailure is None:
#
sMore = ''
#
else:
#
sMore = ' on %s' % self.sayError( oFailure )
#
#
sSayDuration = self.getSayDuration( sURL )
#
print3( 'got %s bytes after %s%s' % ( ReadableNo( iBytes ), sSayDuration, sMore ) )
开发者ID:netvigator,项目名称:myPyPacks,代码行数:16,代码来源:TwistedMethods.py
示例20: doInsert
def doInsert(
oCursor,
oDbApi,
sTable,
tColsSet,
tValsSet,
tColsWhere = None,
tValsWhere = None,
tWhereOper = None,
oValFormatter = None,
bRaiseError = 1 ):
#
# Note! the tColsWhere, tValsWhere, & tWhereOper params are not used!
# they are for plug compatibility with the doUpdate function!
#
from six import print_ as print3
#
sInsertStatement = _getInsertStatement(
sTable, tColsSet, tValsSet, oDbApi, oValFormatter )
#
bGotError = 0
#
# print3( sInsertStatement )
try:
#
oCursor.execute( sInsertStatement )
#
except oDbApi.DatabaseError:
#
bGotError = bRaiseError
#
except:
#
bGotError = bRaiseError
#
#
if bGotError:
#
print3( sInsertStatement )
raise
#
#
if bRaiseError:
return sInsertStatement
else:
return bGotError
开发者ID:netvigator,项目名称:myPyPacks,代码行数:46,代码来源:Insert.py
注:本文中的six.print3函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论