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


Python string.rjust方法代码示例

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


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

示例1: logo

# 需要导入模块: import string [as 别名]
# 或者: from string import rjust [as 别名]
def logo():
    # because ASCII-art is the future!

    logo = '''
                                                            ,,
                                                     mm   `7MM
                                                     MM     MM
                        ,pP"Ybd  ,p6"bo `7M'   `MF'mmMMmm   MMpMMMb.  .gP"Ya
                        8I   `" 6M'  OO   VA   ,V    MM     MM    MM ,M'   Yb
                        `YMMMa. 8M         VA ,V     MM     MM    MM 8M""""""
                        L.   I8 YM.    ,    VVV      MM     MM    MM YM.    ,
                        M9mmmP'  YMbmd'     ,V       `Mbmo.JMML  JMML.`Mbmmd'
                                           ,V
                                        OOb"      ::: account harvester :::'''

    # add version, codename and maintainer to logo
    print logo
    print string.rjust('ver ' + __version__ + ' (' + __codename__ + ')', 74)
    print string.rjust(__maintainer__, 73) 
开发者ID:AnasAboureada,项目名称:Penetration-Testing-Study-Notes,代码行数:21,代码来源:scythe.py

示例2: job_1S

# 需要导入模块: import string [as 别名]
# 或者: from string import rjust [as 别名]
def job_1S(self):
        if self.destItem:
            self._warning.setText( string.rjust(self._processingText, self._thumbSize) )
            self.window().setCursor(Qt.WaitCursor)
                            
            self.scene.setFocus(Qt.MouseFocusReason)
            self.scene.setFocusItem(self.destItem , Qt.MouseFocusReason)
            self.destItem.setSelected(True) 
开发者ID:remig,项目名称:lic,代码行数:10,代码来源:LicAssistantWidget.py

示例3: moveItemToStep

# 需要导入模块: import string [as 别名]
# 或者: from string import rjust [as 别名]
def moveItemToStep(self):
        self._warning.clear()
        if self._item is not None:
            self.scene = self._item.scene()
            srcPage = self._item.getStep().parentItem()      
            try:
                self.destItem = self.scene.selectedItems()[0]
            except IndexError:
                self.destItem = None
            
            # Find Step assigned to currently selected item
            if self.destItem and self.destItem.__class__.__name__ != "Page":
                while self.destItem and not isinstance(self.destItem, Step):
                    try:
                        self.destItem = self.destItem.parent()
                    except:
                        break
            
            # Convert Page to first step on the list
            if self.destItem and self.destItem.__class__.__name__ == "Page":
                if srcPage.number == self.destItem.number:
                    self._warning.setText(self._noMoveText)
                else:
                    if self.destItem.steps:
                        self.destItem = self.destItem.steps[0]
                    else:
                        self._warning.setText(self._noEmptyText)
                    
            # Find the selected item's parent page, then flip to that page
            # Move Part into Step
            canMove = True
            message = ""
            if isinstance(self.destItem, Step):
                destPage = self.destItem.parentItem()
                
                if srcPage.number == destPage.number:
                    canMove = False
                    message = self._noMoveText
                     
                if destPage.isLocked():
                    canMove = False
                    message = self._lockedPageText
                    
                if destPage.isEmpty():
                    canMove = False
                    message = self._noEmptyText
                
                if destPage.__class__.__name__.lower() in ['titlepage' , 'templatepage' ,'partlistpage']:
                    canMove = False
                    message = self._noSpecialPage
                 
                if canMove:        
                    self._worker.start([self.job_1S , self.job_2 , self.job_3])
                
            if message:
                self._warning.setText(string.rjust(message, self._thumbSize)) 
开发者ID:remig,项目名称:lic,代码行数:58,代码来源:LicAssistantWidget.py

示例4: __str__

# 需要导入模块: import string [as 别名]
# 或者: from string import rjust [as 别名]
def __str__(self):
        """
            Returns a string of the new atom type.  Uses the ATOM string
            output but changes the first field to either by ATOM or
            HETATM as necessary.

            Returns
                str: String with ATOM/HETATM field set appropriately
        """
        str = ""
        tstr = self.type
        str = str + string.ljust(tstr, 6)[:6]
        tstr = "%d" % self.serial
        str = str + string.rjust(tstr, 5)[:5]
        str = str + " "
        tstr = self.name
        if len(tstr) == 4 or len(tstr.strip("FLIP")) == 4:
            str = str + string.ljust(tstr, 4)[:4]
        else:
            str = str + " " + string.ljust(tstr, 3)[:3]

        tstr = self.resName
        if len(tstr) == 4:
            str = str + string.ljust(tstr, 4)[:4]
        else:
            str = str + " " + string.ljust(tstr, 3)[:3]
            
        str = str + " "
        tstr = self.chainID
        str = str + string.ljust(tstr, 1)[:1]
        tstr = "%d" % self.resSeq
        str = str + string.rjust(tstr, 4)[:4]
        if self.iCode != "":
            str = str + "%s   " % self.iCode
        else:
            str = str + "    "
        tstr = "%8.3f" % self.x
        str = str + string.ljust(tstr, 8)[:8]
        tstr = "%8.3f" % self.y
        str = str + string.ljust(tstr, 8)[:8]
        tstr = "%8.3f" % self.z
        str = str + string.ljust(tstr, 8)[:8]
        if self.ffcharge != None: ffcharge = "%.4f" % self.ffcharge
        else: ffcharge = "0.0000"
        str = str + string.rjust(ffcharge, 8)[:8]
        if self.radius != None: ffradius = "%.4f" % self.radius
        else: ffradius = "0.0000"
        str = str + string.rjust(ffradius, 7)[:7]
        return str 
开发者ID:MonZop,项目名称:BioBlender,代码行数:51,代码来源:structures.py

示例5: readAtom

# 需要导入模块: import string [as 别名]
# 或者: from string import rjust [as 别名]
def readAtom(line):
    """
        If the ATOM/HETATM is not column-formatted, try to get some
        information by parsing whitespace from the right.  Look for
        five floating point numbers followed by the residue number.

        Parameters
            line:  The line to parse(string)
       if record == ATOM:
            self.serial = int(string.strip(line[6:11]))
            self.name = string.strip(line[12:16])
            self.altLoc = string.strip(line[16])
            self.resName = string.strip(line[17:20])
            self.chainID = string.strip(line[21])
            self.resSeq = int(string.strip(line[22:26]))
            self.iCode = string.strip(line[26])
            self.x = float(string.strip(line[30:38]))
            self.y = float(string.strip(line[38:46]))
            self.z = float(string.strip(line[46:54]))
            try:
                self.occupancy = float(string.strip(line[54:60]))
                self.tempFactor = float(string.strip(line[60:66]))
                self.segID = string.strip(line[72:76])
                self.element = string.strip(line[76:78])
                self.charge = string.strip(line[78:80])
            except ValueError, IndexError:
                self.occupancy = 0.00
                self.tempFactor = 0.00
                self.segID = 0
                self.element = 0
                self.charge = 0
        else: raise ValueError, record
    """

    # Try to find 5 consecutive floats
    words = string.split(line)
    size = len(words) - 1
    consec = 0
    for i in range(size):
        entry = words[size - i]
        try:
            val = float(entry)
            consec = consec + 1
            if consec == 5:      
                break                
        except ValueError:
            consec = 0

    record = string.strip(line[0:6])
    newline = line[0:22]
    newline = newline + string.rjust(words[size-i-1],4)
    newline = newline + string.rjust("",3)
    newline = newline + string.rjust(words[size-i],8)
    newline = newline + string.rjust(words[size-i+1],8)
    newline = newline + string.rjust(words[size-i+2],8)
    newline = newline + string.rjust(words[size-i+3],6)
    newline = newline + string.rjust(words[size-i+4],6)
    cmdstr = "%s(newline)" % record
    obj = eval(cmdstr)
    return obj 
开发者ID:MonZop,项目名称:BioBlender,代码行数:62,代码来源:pdb.py


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