pythonzen
發布時間: 2025-03-08 13:47:42
㈠ 用python編寫程序5.新建一個文本文件zen.txt, 文件內容為「Python之禪」的部分內容,具體如下
strList=[]
line=0
f=open("zen.txt","r")
forvinf.readlines():
arr=v.split()
strList.extend(arr)
line+=1
f.close()
print('行數:',line)
print('單詞:',len(strList))
#行數:4
#單詞:20
㈡ python 編程之禪 怎麼顯示出來
import this
對是的import this這個類就好了
this這個類的內容是根據一定演算法將一些字元重新排列組合變成the zen of python(python之禪)並且在這個類的__(main)__里把python之禪print出來
熱點內容