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

在格式化大數(shù)時,通常是每三位數(shù)放置逗號,使數(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 中的一個秘密超級武器。它經(jīng)常在 Python 的面試題的簡單解答中首次遇到,但它的價值并不限于此。
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 開始,python -m package 將執(zhí)行軟件包中的 __main__ 模塊。這是一個放調(diào)試腳本或命令的好地方,這些腳本主要是用工具執(zhí)行的,不需要很短。
以上就是Python3.1中的特性,希望對大家有所幫助。更多Python學(xué)習(xí)指路:創(chuàng)新互聯(lián)python教程
本文教程操作環(huán)境:windows7系統(tǒng)、Python 3.1,DELL G3電腦。
本文標(biāo)題:創(chuàng)新互聯(lián)Python教程:Python3.1中的特性有哪些
鏈接地址:http://www.5511xx.com/article/djddois.html


咨詢
建站咨詢
