写出下面程序的运行结果。print("ad">"abcd")print("AD">"abcd")print("AD">"ADC")print("tianjin">"beijing")print("天津">"北京")
查看答案
写出下面程序的运行结果。s1="I am a student."s2="C++90分Python88分Java85分"s3="I am a student.\nI like programming.\n"print(s1.split())print(s2.split("分"))print(s2.split("分",2))print(s3.splitlines())
写出下面程序的运行结果。str=" a b c "print("123"+str.strip()+"456")print("123"+str.lstrip()+"456")print("123"+str.rstrip()+"456")
写出下面程序的运行结果。n,f=34,56.78print("%d,%o,%x"%(n,n,n))print("%f,%e"%(f,f))r=5s=3.14*r*rs1="半径为{0}的圆面积为{1}"s2="半径为{radius}的圆面积为{area}"print(s1.format(r,s))print(s2.format(area=s,radius=r))
写出下面程序的运行结果。import repattern=re.compile(r'Student', re.I) #生成正则表达式对象r1=pattern.match('Students study programming')r2=pattern.match('I am a student!',3)r3=pattern.match('I am a student!',7)r4=re.search(r'Student','I am a student',re.I)r5=re.match(r'Student','I am a student',re.I)print(r1)print(r2)print(r3)print(r4)print(r5)