【Python】I/O和比赛的其他一些问题

I/O输入输出

#输入一个字符串分割并转化成n个int数值
a, b= map(int, input().strip().split())
#如果无固定个字符串
try:
  while True:
    a, b= map(int, input().strip().split())
    print(a+b)
except:
    break
#输入一个数值转化为int
#如果接下来输入t个数值
t =int(input().strip())
t =int(input().strip())
while t > 0:
    a,b=map(int,input().strip().split())
    print(a+b)
    t=t-1
#if判断,遇见什么什么结束
while True:
    a, b= map(int, input().strip().split())
    if a==0 and b==0 :
        break
    print(a+b)

---------------------------------------------

#获取最大值

import sys
i = sys.maxsize

----------------------------------------------

#类函数排序重写

def cmp(self,other):
    if self.w <other.w:
        return 1
    elif self.w == other.w:
        return 0
    else:
        return -1

import functools

class Strick():
    def __init__(self,l,w):
        self.l = l
        self.w = w
        
sorted(li,key = functools.cmp_to_key(cmp))