新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
創(chuàng)新互聯(lián)Python教程:Python3.1中的特性有哪些
1、千位數(shù)格式化,可以在使用字符串格式化函數(shù)時(shí)直接完成。

在格式化大數(shù)時(shí),通常是每三位數(shù)放置逗號(hào),使數(shù)字更易讀(例如,1,048,576 比 1048576 更容易讀)。
"2 to the 20th power is {:,d}".format(2**20)
'2 to the 20th power is 1,048,576'2、collections.Counter類是collections的一部分。
是 Python 中的一個(gè)秘密超級(jí)武器。它經(jīng)常在 Python 的面試題的簡(jiǎn)單解答中首次遇到,但它的價(jià)值并不限于此。
hd_song = """ In winter, when the fields are white, I sing this song for your delight. In Spring, when woods are getting green, I'll try and tell you what I mean. In Summer, when the days are long, Perhaps you'll understand the song. In Autumn, when the leaves are brown, Take pen and ink, and write it down. """
3、執(zhí)行軟件包中的 __main__ 模塊。
從 Python 3.1 開(kāi)始,python -m package 將執(zhí)行軟件包中的 __main__ 模塊。這是一個(gè)放調(diào)試腳本或命令的好地方,這些腳本主要是用工具執(zhí)行的,不需要很短。
以上就是Python3.1中的特性,希望對(duì)大家有所幫助。更多Python學(xué)習(xí)指路:創(chuàng)新互聯(lián)python教程
本文教程操作環(huán)境:windows7系統(tǒng)、Python 3.1,DELL G3電腦。
網(wǎng)頁(yè)題目:創(chuàng)新互聯(lián)Python教程:Python3.1中的特性有哪些
轉(zhuǎn)載源于:http://www.dlmjj.cn/article/djddois.html


咨詢
建站咨詢
