• 排序,其他的运用 os fork


     1 while True:
     2     str_num = input("Enter number:")
     3 
     4     flag = True
     5     dotCount = 0
     6     if str_num[0] == '-':
     7         str_num_copy = str_num[1:]
     8     else:
     9         str_num_copy = str_num
    10     for ch in str_num_copy:
    11         if ch>='0' and ch <= '9':
    12             continue
    13         elif ch == '.':
    14             dotCount += 1
    15             if dotCount>1:
    16                 flag = False
    17                 print("您输入的内容不规范,请重新输入")
    18                 break
    19             continue
    20         else:
    21             flag = False
    22             print("您输入的内容不规范,请重新输入")
    23             break
    24     if flag == True:
    25         print(float(str_num))
    26         break
    27 
    28 # import math
    29 # while True:
    30 #     x = input('Enter number:')
    31 #     y = int(x) / 6
    32 #     num = math.ceil(y)
    33 #     print(num)
    34 # # 用列表解析的方式
    35 # while True:
    36 #     x = input('Enter number:')
    37 #     num = int(x)
    38 #     page = num // 6
    39 #     n = 1 if num%6!=0 else 0
    40 #     print(page+n)
    41 
    42 
    43 #排序
    44 # list1 = [5,4,3,2,1,2,3,4,5]
    45 # #对list1进行排序 排序之后改变了id号
    46 # l = sorted(list1)#result:[1, 2, 2, 3, 3, 4, 4, 5, 5]
    47 # print(l)#[1, 2, 2, 3, 3, 4, 4, 5, 5]
    48 # print(id(l),id(list1))#43557960 43558536
    49 #
    50 # list1 = [5,4,3,2,1,2,3,4,5]
    51 # #对list1进行排序 排序之后改变了id号
    52 # l = list1.sort()
    53 # print(l,list1)# None [1, 2, 2, 3, 3, 4, 4, 5, 5]
    54 # print(id(l),id(list1))#1790284944 43688648
    55 #
    56 # list1 = [5,4,3,2,1,2,3,4,5]
    57 # print(id(list1))#43689032
    58 # #对list1进行排序 排序之后不改变id号
    59 # list1.sort()
    60 # print(list1)#[1, 2, 2, 3, 3, 4, 4, 5, 5]
    61 # print(id(list1))#43689032
    import os
    #fork不支持windows上面运行
    if __name__ == '__main__':
        pid = os.fork()
        print(pid)
  • 相关阅读:
    进程与线程
    the art of seo(chapter seven)
    the art of seo(chapter six)
    the art of seo(chapter five)
    the art of seo(chapter four)
    the art of seo(chapter three)
    the art of seo(chapter two)
    the art of seo(chapter one)
    Sentinel Cluster流程分析
    Sentinel Core流程分析
  • 原文地址:https://www.cnblogs.com/zhangboblogs/p/8623719.html
Copyright © 2020-2023  润新知