Ô´´úÂëÏÂÔØ£ºÏÂÔصØÖ·ÔÚÕâÀï
# 022
listNum1 = [1, 3]
listNum2 = [2, 4]
listStr1 = ['a', 'c']
listStr2 = ['b', 'd']
# ÁбíµÄºÏ²¢
list1 = listNum1 + listStr1
for ele in list1:
print ele
print '\n'
# ÅжÏÁбíÖÐÊÇ·ñ°üº¬Ä³ÔªËØ
print 'b' in list1
print 1 in list1
# ɾ³ýij¸öÔªËØ
for ele in list1:
print ele
del list1[1]
for ele in list1:
print ele
print '\n'
# ¶ÔÁбí½øÐÐÅÅÐò
list1 = listNum1 + listNum2 + listStr1 + listStr2
for ele in list1:
print ele
print '\n'
list1.sort()
for ele in list1:
print ele
print '\n'
# ¶ÔÁбí½øÐе¹ÅÅÐò
list1 = listNum1 + listNum2 + listStr1 + listStr2
for ele in list1:
print ele
print '\n'
list1.sort(reverse = True)
for ele in list1:
print ele
print '\n'
# ¶ÔÁбí½øÐÐÄæÐò
list1 = listNum1 + listNum2 + listStr1 + listStr2
for ele in list1:
print ele
print '\n'
list1.reverse()
for ele in list1:
print ele
print '\n'
# ɾ³ýÁбíÖÐÁ¬ÐøµÄÒ»²¿·Ö
list2 = listNum1 + listNum2 + listStr1 + listStr2
list1 = list2
list1.sort()
for ele in list1:
print ele
print '\n'
del list1[0:2]
for ele in list1:
print ele
print '\n'
# PythonÖÐÁбí±È½ÏµÄÊÇÖµ¶ø²»ÊÇÒýÓÃ
list3 = [1, 3, 'a', 'c']
list4 = listNum1 + listStr1
print list3 == list4, '\n'
# ÁÐ±í¾¹È»¿ÉÒԱȽϴóС
list5 = ['b', 'c']
list6 = ['a', 'z']
print list5 > list6, '\n'
# ÌáÈ¡ÔªËØ
list1 = listNum1 + listNum2 + listStr1 + listStr2
print list1
print list1[7]
print list1[0:4]
# ÁбíµÄÆ´½Ó
list1 = [1,2,3]
list2 = [2,3,4]
list1 += list2
print list1, '\n'
# ÁбíµÄ·±¶
list1 = [1,2,3]
i = 3
list1 *= i
print list1
# Ìí¼ÓÔªËصÄÁ½ÖÖ·½·¨
list1 = [1,2,3]
list1 += [4]
print list1
list1 = [1,2,3]
list1.append(4)
print list1
# È¡µÃÔªËظöÊýµÄ·½·¨
list1 = [1,2,3]
print len(list1)
# È¡µÃÌض¨ÔªËصĸöÊý
list1 = [1,2,2,3,4,4,4]
print list1.count(2)
print list1.count(4), '\n'
# ÔÚÁбíÖÐÑ°ÕÒÌض¨µÄÔªËØ
list1 = ['a', 'b', 'c', 'a', 'b', 'c', 'a']
print list1.index('a')
print list1.index('a', 1)
Ê×ÏÈÒª¸ãÇå³þ£¬×Ö·û´®ÔÚPythonÄÚ²¿µÄ±íʾÊÇunicode±àÂ룬Òò´Ë£¬ÔÚ×ö±àÂëת»»Ê±£¬Í¨³£ÐèÒªÒÔunicode×÷ΪÖмä±àÂ룬¼´ÏȽ«ÆäËû±àÂëµÄ×Ö·û´®½âÂ루decode£©³Éunicode£¬ÔÙ´Óunicode±àÂ루encode£©³ÉÁíÒ»ÖÖ±àÂë¡£
decodeµÄ×÷ÓÃÊǽ«ÆäËû±àÂëµÄ×Ö·û´®×ª»»³Éunicode±àÂ룬Èçstr1.decode('gb2312')£¬±íʾ½«gb2312±àÂëµÄ×Ö·û´®×ª»»³ ......
´úÂëºÜ¼òµ¥£¬²»µ½5kÐС£µ«ÊÇ˼·ͦºÃµÄ£¬¸Ä³Énon-blockingÁËÖ®ºóЧÂʾÍÊÇÄÜÌá¸ß²»ÉÙ£¬ÌرðÊÇ¿¼Âǵ½ÏÖ´úµÄweb app¶¼ÐèÒªºÍÆäËûµÄ
HTTP·þÎñÆ÷ͨÐÅ£¬blockingµÄ´ú¼ÛÌ«´óÁË¡£ Tornado is an open source version of the scalable, non-blocking web server and tools that power FriendFeed. The FriendFeed application ......
¡¡¡¡ÓÐʱºò£¬Òª°ÑÄÚ´æÖеÄÒ»¸ö¶ÔÏó³Ö¾Ã»¯±£´æµ½´ÅÅÌÉÏ£¬»òÕßÐòÁл¯³É¶þ½øÖÆÁ÷ͨ¹ýÍøÂç·¢Ë͵½Ô¶³ÌÖ÷»úÉÏ¡£PythonÖÐÓкܶàÄ£¿éÌṩÁËÐòÁл¯Óë·´ÐòÁл¯µÄ¹¦ÄÜ£¬È磺marshal, pickle, cPickleµÈµÈ¡£½ñÌì¾Í½²½²marshalÄ£¿é¡£
¡¡¡¡×¢Ò⣺
marshal²¢²»ÊÇÒ»¸öͨÓõÄÄ£¿é£¬ÔÚijЩʱºòËüÊÇÒ»¸ö²»±»ÍƼöʹÓõÄÄ£¿é£¬ÒòΪʹÓÃmarshalÐ ......