国产激情自拍_国产9色视频_丁香花在线电影小说观看 _久久久久国产精品嫩草影院

首頁 > 學院 > 開發設計 > 正文

Notes of Py for informatics

2019-11-10 20:17:29
字體:
來源:轉載
供稿:網友

Chapter 2 Var, exp and statements

2.1 Type Conversion

sval = '123'type(sval)ival = int(sval)PRint ival+1

2.2 User Input

nam = raw_input('Who are you?') # the screen shows 'Who are you?', and the input value is saved in namprint 'Welcome', nam# if we want to read a number from the user. We must convert it from a string to a number using a type conversion functioninp = raw_input('Europe Floor?')print 'American Floor:', int(inp)+1

Chapter 3 Conditional execution

3.1 One Way Decision & Indentation

if x == 6:   print 'is 6'   print 'is still 6'Turn off tabs: If you mix tabs and spaces, you may get 'indentation errors'.

3.2 Two Way Decisions

if x > 2:   print 'Bigger'else:   print 'Smaller'

3.3 Muti-way

if x < 2:   print 'small'elif x < 10:     #elif -> else if   print 'medium'else:   print 'large'print 'all done'3.4 try / except structure

You surround a dangerous section of code with try and except.

If the code in the try works - the except is skipped.

If the code in the except works - the try is skipped.

astr = 'Hello Bob'try:    istr = int(astr)  # if the input is 'qwe', then the 'try' can not be executedexcept:    istr = -1comment: have a try. It's totally different from the if/else. It has a network. 'a blow up' stuff.example:

rawstr = raw_input('Enter a number:')try:    ival =int(rawstr)except:    ival = -1if ival > 0:    print 'Nice work'else:    print 'Not a number'3.5 if not

Chapter 4 Functions

two types of functions:

build-in functions

functions that we define ourselves and then use

no arguments:

def print_lyrics():    print "I sleep all night and I work all day"

arguments:

def greet(lang):    if lang == 'es':       print 'Hola'....

return value:

def greet(lang):    if lang == 'es':       return 'Hola'....print greet('es')

multiple parameters / Arguments:

def addtwo(a,b):    added = a + b    return addedvoid function

Chapter 5 Loops and Iteration

5.1 breaking out of a loop

while True:    line = raw_input('>')    if line == 'done':        break    print lineprint 'Done!'break: end the current loop and jump to the statement immediately following the loop

5.2 continue

the continue statement ends the current iteration andjumps to the top of the loop and starts the next iteration

5.3 Indefinte Loops & definite Loops

Indefinte Loops: While loops are called "indefinite loops" because they keep going until a logical condition becomesFalse.  while

Defintie Loops: finite list of things to do. For

for i in [5,4,3,2,1]:    print i print 'Blastoff!'
friends = ['Joe','Sally','Mike']for friend in friends:    print 'Happy New Year:', friendprint 'Done!'

5.4 Loop Idioms
smallest = None...if smallest is None: # trigger the first iteration  #if value is None/True/False is ok # if value is 4     ..elif value < smallest:    smallest = valueChapter 6 Strings

both quotes: 'Hello' and "Hello" are ok

'+' means concatenate

6.1 Look inside strings

fruit = 'banana'letter = fruit[1]print letter

output:

a

you will get a python error if you attempt to indexbeyond the end of a string

len(fruit)
# approach1
index = 0while index < len(fruit):    ...    index = index + 1
# approach2
for letter in fruit:     ...# I love the 'in'

6.2 Slicing Strings: colon Operator

s = 'Monty Python'print s[0:4]  #starts from1, up to but not including 4

output:

Mont

print s[:2]print s[8:]print s[:]

output:

MothonMonty Python

6.3 Using in as an operator

print 'nan' in fruit

Output:

True

Word < 'banana'word == 'banana'#comparison6.4 String Library

xxx.function()

These functions do not modify the original string, instead theyreturn a new string that has been altered.  =

greet = 'Hello Bob'zap = greet.lower()print zap

output:

hello bob

print dir(greet)['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']

Find

pos = fruit.find('na')print posoutput:

2
pos = fruit.find('a',pos+1) #starts from the position of the next characterfind() finds the first occurance of the substring

if the substring is not found, find() returns-1

Replace

nstr = greet.replace('Bob','Jane')print nstrHello JaneStripping Whitespace

Sometimes we want to take a string and remove whitespace at the beginning and/or end

lstrip() #left

rstrip() #right

strip() #all

greet = '     Hello Bob'print greet.strip()     Hello BobHello Bob

Prefixes

print greet.startswith(' ')True


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
国产激情自拍_国产9色视频_丁香花在线电影小说观看 _久久久久国产精品嫩草影院
国产一级免费黄色片| 97操碰视频| 国产精品人人| 狠狠操五月天| 日本高清不卡中文字幕| 18被视频免费观看视频| 国产理论电影在线| 免费在线看v| 午夜国产视频| 免费av在线| 免费精品国产自产拍在| 欧美国产中文| 久久综合第一页| 国产在线一二| 午夜视频在线免费| 开心激情五月婷婷| 九九热在线视频| www在线观看播放免费视频日本| 一区二区三区免费视频网站| 在线视频三级| www.狠狠插| 激情在线视频播放| 全网国产福利在线播放| 麻豆电影传媒二区| 在线视频婷婷| 久久久久久日本一区99| 激情亚洲综合网| 超碰免费97在线观看| 国内a∨免费播放| 中文字幕网在线| 精品国内一区二区三区免费视频| 国产www在线观看| 日本啊v在线| 综合激情亚洲| 国产白浆在线| 交视频在线观看国产| 精品中文字幕不卡在线视频| 国产美女高潮| 97在线超碰| 午夜性爽视频男人的天堂| 国产在线观看a视频| 五月亚洲综合| www在线免费观看视频| 黄色一级片视频| 天堂在线看视频| 一区二区三区免费视频网站| 中文字幕不卡免费视频| 亚洲天堂久久久| 国产一卡二卡3卡4卡四卡在线| 国产黄色网页| 国产一区二区三区美女秒播| www操操操| 在线国产三级| 国产网站免费看| 国产黄色av免费看| 国产乱妇乱子在线播视频播放网站 | 青青青手机在线视频观看| 五月亚洲综合| 黄色电影网站在线观看| 日本电影全部在线观看网站视频| 7777在线| eeuss影院在线观看第一页| 99热免费在线观看| 精品美女视频在线观看免费软件| 精品久久久久一区二区三区| 国产色婷婷在线| √8天堂资源地址中文在线| 96久久久久久| 欧美日韩在线中文字幕| 蜜桃视频中文字幕| 五月综合激情在线| 一级二级在线观看| 国产美女极品在线| 在线中文资源天堂| 丁香花高清视频完整版在线观看| 国产一级视频| 国产黄色在线网站| 欧美高清视频| 国产日本在线观看| 亚洲综合在线网| 伊人伊人av电影| 伊人222成人综合网| 国产在线激情视频| 成人精品福利| 精品麻豆国产| av在线资源网| www.91av| 欧美婷婷久久五月精品三区| 牛牛精品视频在线| 青青草原国产在线| 开心婷婷激情| 国产男女无套在线播放| 超碰在线网站| 国产一卡2卡3卡4卡网站免费 | 91在线超碰| 在线观看av中文| 免费在线看v| 成人精品一区二区三区免费| 成网站在线观看人免费| 国产一区二区三区福利| 精品国内自产拍在线视频| 亚洲视频精品在线观看| 天天av天天爱| 在线观看视频污| 国产在线视频网站| 国产美女一区视频| 国产福利一区二区在线精品| 99在线视频观看| 黄色av免费在线| 狠狠干五月天| 成网站在线观看人免费| 日本亚洲欧美| 最近中文字幕在线中文视频| 尤物在线视频| 在线午夜视频| 国产素人视频在线观看| 在线观看视频污| 二人午夜免费观看在线视频| 国产女人伦码一区二区三区不卡| eeuss影院www在线观看| 国产视频在线播放| 亚洲精品xxxxx| 92国产在线视频| 国产特级毛片| 精品a在线观看| 国产美女一区视频| 久热国产在线| 久久综合精品视频| 亚洲精品aaaa| 92久久精品| 日本中文字幕在线观看| www在线视频观看| 亚洲an天堂an在线观看| 中文产幕区在线观看| 国产秀色在线www免费观看| 国产精品国精产品一二| 蜜桃av网站| xxxx视频在线| 色中文字幕在线| 国产天堂在线观看| 五月婷婷视频在线观看| 日本成a人片在线观看| a视频免费看| av影视在线看| 国产小视频在线| 国产午夜视频| 国产三区视频在线观看| 国产精品久久久久久久久鸭 | 中文日本在线观看| 最近中文字幕在线中文视频| 天天激情综合| 亚洲第一成年免费网站| 国产精品伦一区二区三区级视频频| 国产乱视频在线观看| 亚洲精品一线| 国产精品99999| 97国产在线| 亚洲精品视频区| 久久久久久77777| 国产福利在线| 在线观看的网站你懂的| av在线二区| av免费在线观| 国产资源在线看| 国产黄a三级三级三级av在线看| 精品一区二区三区高清免费不卡 | 国产精选在线观看| 午夜视频99| 日本在线观看| 国产网红在线观看| 青青草原av在线| 亚洲精品自拍区在线观看| 久久久久久五月天久久久久久久久| √天堂8资源中文在线| 四虎国产精品永久| 国产嫩草在线视频| av免费在线观看网站| 午夜国产福利在线| 日本啊v在线| 国产精品xxx电影| 国产毛片在线| 精品国产美女福利到在线不卡| 成年女人在线视频| 精精国产xxxx视频在线动漫| 噜噜噜噜噜在线视频| 美女av在线播放| 亚洲www色| 精品美女视频在线观看免费软件| 欧美高清xxxx性| 国产成人亚洲欧美电影| 国产农村一级特黄α**毛片| 亚洲日本一区二区三区在线观看| 国产偷窥洗澡视频| 樱花草在线观看www| 国产一二三在线观看| 青青九九免费视频在线| 在线黄色av| 伊人影院在线观看| 在线视频三区| 人人干人人插|