本文整理汇总了Python中six.print3函数的典型用法代码示例。如果您正苦于以下问题:Python print3函数的具体用法?Python print3怎么用?Python print3使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print3函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sayResultMaybe
def sayResultMaybe( self, sResult, iSlot ):
#
from Time.Output import sayLocalTime
#
if self.bSayEachResult:
#
print3( '%s %s Slot %s' % ( sResult, sayLocalTime(), iSlot ) )
示例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 )
示例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!' )
示例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
示例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 )
示例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
示例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
示例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
示例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() ) )
示例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 ) )
示例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
示例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()
示例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()
示例14: main
def main( sChopDir ):
#
import time
#
sChopDir = getArgs( sChopDir )
#
if sChopDir is not None:
#
print3( 'Chopping file names...' )
#
iStart = time.time()
#
ChopNames( sChopDir )
示例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 ) ) )