Python3:

strip :将两端的空白字符去掉,返回str

slipt :将字符串用空白字符分开,返回[str]

map:把list里面的值映射到指定类型,返回[type]

 

isspace:是否用空行组成

EOF用来抓异常

输出加','不换行

Python3不能用raw_input(),而是用input()就行了,输出必须加“()”。

 

一般读入都是:

#读入的数据, 收到的是字符串格式
n = input()

#读入数字
n = eval(input())

#读入两个
n, m = map(int, input().split())

#一行读入多个数据,返回的是list, 默认是以空格分割
an = list(map(int, input().split()))

 

有多组输入遇见EOF结束

while True:
    try:
        n = input()
     n = n.strip()
except EOFError: exit(0)

 

相关文章:

  • 2022-01-17
  • 2022-12-23
  • 2021-07-27
  • 2022-01-08
  • 2021-10-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-02
  • 2021-12-27
  • 2022-01-04
  • 2021-11-27
  • 2021-05-19
相关资源
相似解决方案