本文整理汇总了Python中fractions.Fraction.lower方法的典型用法代码示例。如果您正苦于以下问题:Python Fraction.lower方法的具体用法?Python Fraction.lower怎么用?Python Fraction.lower使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fractions.Fraction
的用法示例。
在下文中一共展示了Fraction.lower方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: elif
# 需要导入模块: from fractions import Fraction [as 别名]
# 或者: from fractions.Fraction import lower [as 别名]
# You can "unpack" letters of a string to variables
str1 = "World"
x1,x2,x3,x4,x5 = str1 # x1=W, x2=o, x3=r, x4=l, x5=d
x = 'abcdef'
# x[0] = 'a' x[-1] = 'f' x[1:3] = 'bc' x[0:2] + x[5:] = 'abf'
print 'Python'.lower() # 'python'
print 'Python'.upper() # 'PYTHON'
x = 'Abc'
y = 'abc'
if(x == y):
print 'x and y: identical'
elif(x.lower() == y.lower()):
print 'x and y: case insensitive match'
else:
print 'x and y are different'
import string
str1 = 'this is a string'
print string.ljust(str1, 10) # book said lstring, but dir says ljust
print string.rjust(str1, 40)
print string.center(str1, 40) # these position text left, right, and center
print 'First 7 chars:', str1[0:7]
print 'Chars 2-4:', str1[2:4]
print 'Right-most char:', str1[-1]
print 'Right-most 2 chars:', str1[-3:-1] # can do str1[-3:] to display last 3 chars