與小卡特一起學python 第21章 列印格式化與字串
# -*- coding: utf-8 -*-
#21-1 列印正方形和立方體
print("Number \tSquare \tCube")
for i in range (1,11):
print(i,'\t',i**2,'\t',i**3)
dec_number =12.3456
print("It is %.2f degrees today." % dec_number)
print("%f" % dec_number)
number = 12.3456
print("%.3f" % number)
my_string ="%.2f " % 12.3456
print(my_string)
print("The answer is ",my_string)
#21-1 列印正方形和立方體
print("Number \tSquare \tCube")
for i in range (1,11):
print(i,'\t',i**2,'\t',i**3)
dec_number =12.3456
print("It is %.2f degrees today." % dec_number)
print("%f" % dec_number)
number = 12.3456
print("%.3f" % number)
my_string ="%.2f " % 12.3456
print(my_string)
print("The answer is ",my_string)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/220205/viewspace-2088971/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Python中的字串與字串格式化Python字串格式化
- python學習:變數與字串Python變數字串
- python學習之字串常用方法和格式化字串Python字串
- Python:字串格式化Python字串格式化
- Python 學習筆記(6)— 字串格式化Python筆記字串格式化
- Python 字串格式化(Python IO)Python字串格式化
- Python 字串格式化指南Python字串格式化
- python字串的格式化Python字串
- 與你一起寫小程式
- python字串格式化輸出Python字串格式化
- (007)我們一起學Python;元組和字串Python字串
- 全網最適合入門的物件導向程式設計教程:54 Python字串與序列化-字串格式化與format方法物件程式設計Python字串格式化ORM
- Python 字串格式化輸出方式Python字串格式化
- Python知識點:字串格式化Python字串格式化
- Python中的字串格式化方法Python字串格式化
- python字串格式化的方法整理Python字串格式化
- 學習Rust 集合與字串Rust字串
- 與 MDN 一起學習 JavaScriptJavaScript
- Python--I/O格式化與運算子Python
- 如何使用 Python 進行字串格式化Python字串格式化
- python為什麼要字串格式化Python字串格式化
- 【轉載】Python字串操作之字串分割與組合Python字串
- Go語言學習(5) - 列印格式化Go
- Python學習筆記:第3天 字串的操作Python筆記字串
- 【Python自動化Excel】Python與pandas字串操作PythonExcel字串
- [轉]Python格式化字串的4種方式Python字串
- 教你Python格式化字串的3種方法Python字串
- Python中format函式字串格式化入門PythonORM函式字串格式化
- 第 六小節 常量與列舉
- Python 工匠:使用數字與字串的技巧Python字串
- 格式化字串字串
- 字串 格式化字串
- 字串與JSON字串JSON
- Python中對字串格式化的方法:%、format()、以及f+字串詳解Python字串格式化ORM
- Golang字串格式化Golang字串格式化
- Golang 字串 格式化Golang字串
- 【數學】組合數學 - 卡特蘭數
- python--字串格式化用於批量讀取圖片Python字串格式化
- Python 使用者輸入和字串格式化指南Python字串格式化