learn python once again - -
前12节也就 print raw_input 和 %r %s 格式输出的内容了
总结一下陌生的东西吧:
1、配置 Python 使得 Windows cmd 可用
2、raw_input() 与 input() 的区别?
raw_input() 就是对用户输入进行读取,所有输入的内容都以字符串格式读入,对于 input 希望读入的是 python 格式化数据,所以 abc = input(abc) 是不可以的,abc = input('abc') 才可以
abc = raw_input("try to print abc: ")
print "abc=", abc # this is ok
abc = raw_input("try to print abc: ")
print "abc=", abc # this is NOT ok
Traceback (most recent call last):
File "C:/Python27/mystuff/test.py", line 1, in <module>
abc = input("try to print abc: ")
File "<string>", line 1, in <module>
NameError: name 'abc' is not defined
3、%r 和 %s 的区别 (还没弄明白)
abc = 'abc'
bcd = "bcd"
print "abc = %r bcd = %r", %(abc, bcd)
print "abc = %r bcd = %r", %(abc, bcd)
http://segmentfault.com/q/1010000000163896
时间进度:
15:03-15:56 exercise 0-4
-16:14 exercise 5
-16:23 exercise 6
-16:31 exercise 7
-16:59 exercise 8
-17:03 exercise 9
-17:09 exercise 10
-17:36 exercise 11
-17:58 exercise 12
-18:22 exercise 13
上班儿还可以学python - -