标签:输出 input blog -- python over eval file div
# -*- coding:utf-8 -*- x = "hello " y = "world" print x+y print "hello "+y #repr() eval() x = repr("hello") val = eval(x) print x print val print "hello" print str("hello world!") y = [1,2,3,4] print repr(y) print str(10000L) print repr(1000L) temp = 42 print "The temperature is "+repr(temp) #raw_input() name = raw_input("what is your name?") print "hello, " + name + "!" #长字符串、原始字符串和Unicode #长字符串 print ‘‘‘This is a very long string. It continues here. And it‘s not over yet. "Hello world!" Still here.‘‘‘ #反斜线使换行符转义 print "hello, world!" print 1+2+3 print "hello world" #换行符\n print ‘Hello \nworld!‘ #打印反斜线 print ‘C:\\nowhere‘ #打印路径---打印原始字符串 print "C:\\Program Files\\fnord\\foo\\bar\\baz\\frozz\\bozz" print r‘C:\nowhere‘ print r‘C:\Program Files\fnord\foo\bar\baz\frozz\bozz‘ print r‘Let\‘s go!‘ print ‘Let\‘s go!‘ #原始字符串最后一个字符不能是反斜线 #print r"This is illegal\" #要想在输出字符串末尾加反斜线,可以再接一个单独的字符串来处理 print r"This is illegal"‘\\‘ #Unicode字符串 print u‘张‘ print u‘Hello world!‘
标签:输出 input blog -- python over eval file div
原文地址:http://www.cnblogs.com/HITSZ/p/6674880.html