@Sarah
        
        2016-04-03T14:00:40.000000Z
        字数 1665
        阅读 936
    区分大小写,字幕开头
input = raw_input("Please enter your name")print input//function exampledef print_lyrics():print "Im a AAA"print 'I sleep'print_lyrics()//rerurn valuesdef greet():return "Hello"print greet(), "Gleen"print greet(), "Sally"//while Loopsn = 5while n>0:print bn = n-1print 'Blastoff!'print n//Breaking out of a loopn = 5while True:print nif n == 3:break//finishing an iteration with continuen = 5while n>0:n=n-1if n>=3:continueprint n//For Loopfor i in [5,4,3,2,1]:print iprint 'Blastoff'//if elif elseif x<y:print 'x is less than y'elif x>y:print 'x is greater than y'else:print 'x and y are equal'//try and catchinp = raw input("Enter Fahrenheit Temperature:')try:fahr = float(inp)cel = (fahr -32.0)*5.0/9.0print cetexcept:print 'please enter a number'//Stringsstr1 = 'H'str2 = 'T'bob = str1 + str2print bobstr3 = '123'str3 = int(str3)+1print str3
//indexfruit = 'b'x = len(fruit)print xfor letter in fruit:print letter//s = 'Monday Python'print s[0:4]print s[6:7]print s[6:20]s ='Monday Python'print s[:2]print s[8:]print s[:]//true anf falsefruit = 'banana''n' in fruit'm' in fruit'nan' in fruitif 'a' in fruit:print 'Found it!'//String librarystr.capitalize() 首字母大写str.upper() 全部大写str.lower()小写str.find() finds the first occurrence of the substring.没找到的话返回-1str.replace()str.lstrip()str.strip()str.startswith()搜搜用啥开头的字符串不能够改变。
list1 = [2,3]
// 
range(4) 
// 
a = [1,2] 
b= [3,4] 
c = a+b 
print c
// 
list1.remove(2) 
list1.append(2)
//常用列表函数 
list.pop() 
.reverse() 
.sort() 
.count() 
.index() 
.max() 
.min() 
.sum()
// 
purse = dict() 
purse['m'] = 12 
purse['c']=5
//tuple 
d = {'a':10,'b':1,'c':22} 
t = d.items() 
print t
for k.v in c.items(): 
    temp.append((v,k)) 
print tmp
c = {'a':10,'b':2,'c':13} 
print sorted c
```
```python
import re 
x = "wwwwweetjyuketgha34273i5" 
y = re.findall('[0-9]',x) 
print y
// 
import re 
x = "From: Using the : character"
// 
y = re.findall('\s+@\s',x)