Python初始化

Python字符串


#该函数检查是不是按字典序排列的
def IsDictionaryOrder(name):
    p=name[0]
    for i in name:
        if p>i:
            return False
        p=i
    return True
for line in f:
    line=line.strip()
    if IsDictionaryOrder(line):
        print(line)

字符串格式化:

import math
print('hello world {:>9.10f}'.format(math.pi))

Python字符串

Python字符串

相关文章: