想到什么写什么:
①常用于acm题目中输入一个n值,并且进行n次循环的过程
for _ in range(int(input())):
②输入一个二维数组。
slist=[[input(),float(input())]for _ in range(n)]
san :输入str,将大写转换为小写,小写转换为大写
print ''.join([i.lower() if i.isupper() else i.upper() for i in raw_input()])
Python join() 方法用于将序列中的元素以指定的字符连接生成一个新的字符串。
str = "-"; seq = ("a", "b", "c"); # 字符串序列
print str.join( seq );
输出结果a-b-c
④:% 和%s的输出时的用法
print (("Hello %s %s! You just delved into python.") % (first_name, last_name))
"%s" says that a string should be inserted in that position instead of the characters. Since there are 2 of them we need to add two strings into it.
the "%" says that the things after this are the strings we wanna replace with.