堪錯版1:total =0gradeCounter =0while 1: sex=raw_input("Enter sex") grade = raw_input("Enter grade,-1 to end:") grade=int (grade) if sex == "stop":break if sex=="F" and grade >=65: gradeCounter+=1 total=total+1print
老師教的還是很認真的,而且課也生動,這是第十六課了。還是看代碼:output =file('hello.txt','r')#output.write('/t you are a big /n apple')read_output=output.readlines()print read_output[2]output.close()上面的‘r’可以換成‘w’和‘a’來表示不同的意義,讀寫和追加,大家都是從VB和C語言過來的不是,不用說那麼多了吧,都明白,呵呵,下面繼續。output =file(
Word Cloud is popular in many web pages. Today, I find one simple way to generate word cloud by python. Here, we use pytagcloud package. It is can be find by Google.We used :python setup.py installto install this package in python2.7In the next, we
Python中的切片功能強大。但是切片很容易讓人搞混。個人覺得Python的文檔不怎麼好,好多東西都是零散的,更像教科書。下面的參考來自Python3.2文檔和Python參考手冊(第4版):a = [1,2,3,4]x = a[1:2] #a.__getitem__(slice(1,2,None))slice([start], stop[, step])Return a slice object representing the set of indices specified by
http://blog.csdn.net/idisposableFirst Eye on Boo Language 在.NET平台上,除了IronPython之外,Python還有另外一個親戚 - Boo。但是Boo語言並不真正是Python語言的實現,它只是有著和Python一樣的外衣而已。 ===========================================================下面是我讀BooPrimer的學習筆記,:)1.
目前在研究學習使用pythob-libvirt api 操作vm,幾經周折才完成了遷移功能:代碼如下:import libvirt# virsh migrate --live kk qemu+tcp://192.168.4.87/system tcp://192.168.4.87#conn=libvirt.open('qemu:///system')#dest_conn=libvirt.open('qemu+tcp://192.168.4.87/system')vm_domain=conn.