zoukankan      html  css  js  c++  java
  • python-输入输出

    1)raw_input(实现无限输入,Python2.7)

    while True:
        try:
           n,m = map(int,raw_input().split())#有限个数值。去掉map部分就是多个字符串
        sc = map(int,raw_input().split())#多个数值,返回的是一个list。去掉map部分就是多个字符串 for i in range(m): action, sc1, sc2 = raw_input().split()#有限个字符串
     
               if action == 'Q':
                   if int(sc1) <= int(sc2):
                        print(max(sc[int(sc1)-1 : int(sc2)]))
                   else:
                       print(max(sc[int(sc2) - 1: int(sc1)]))
               elif action == 'U':
                   sc[int(sc1)-1] = int(sc2)
        except:
            break

    2)sys.stdin.readline()

     import sys
        #将上面的 raw_input().split() 替换成 sys.stdin.readline().strip().split()
        #可以用[int(i) for i in raw_input.split()] 代替 map

    3)正则表达式输入

    参考链接

    4)

  • 相关阅读:
    mysql find_int_set
    PHPSTROM8.0 注册码(7.1也可用)
    gym 101657 D
    gym101657 C
    poj 3525
    poj1279
    poj3335
    poj 1228
    poj 1873
    poj 2074
  • 原文地址:https://www.cnblogs.com/xiangzhi/p/9600210.html
Copyright © 2011-2022 走看看