輸出
- print 'hello,world'
- print語句也可以跟上多個字符串,用逗號隔開,就可以連成一串輸出:
print 'The quick brown fox', 'jumps over', 'the lazy dog'
輸出的時候趣竣,遇到逗號“,”會輸出一個空格。 - print也可以打印整數(shù),或者計算結(jié)果:
print 300
print 100+200
print '100 + 200 =',100 + 200
輸入
- name = raw_input()
輸入的內(nèi)容就會存到變量中傻粘,可以直接輸入name查看變量內(nèi)容:
name - 可以改成一個有意義的程序
name = raw_input()
print 'hello,',name - 輸入的時候,沒有任何提示信息告訴用戶帮掉,這樣很不友好弦悉,可以加一個字符串
name = raw_input('please enter your name:')
print 'hello,',name