#Python TQC考題102
a=eval(input())
b=eval(input())
c=eval(input())
d=eval(input())
print(“|{:7.2f} {:7.2f}|”.format(a,b))
print(“|{:7.2f} {:7.2f}|”.format(c,d))
print(“|{:<7.2f} {:<7.2f}|”.format(a,b)) #靠左
print(“|{:<7.2f} {:<7.2f}|”.format(c,d)) #靠左
# | 在Enter鍵上方
#需設定小數點下2位
Spyder執行結果:

n1 = eval(input())
n2 = eval(input())
n3 = eval(input())
n4 = eval(input())
print(“|%7.2f %7.2f|” %(n1,n2)) #靠右
print(“|%7.2f %7.2f|” %(n3,n4)) #靠右
print(“|%-7.2f %-7.2f|” %(n1,n2)) #靠左
print(“|%-7.2f %-7.2f|” %(n3,n4)) #靠左

#欄與欄間隔一個空白字元
#%7.2f %7.2f中間多一個空白
#錯這裡的話,檢查不出來



![Python 讀取 DOCX 圖片關聯:qn+find/findall 與 XPath 的實戰對照 from lxml import etree ; from docx.oxml.ns import qn; lxml.etree._Element.findall( f”.//{ qn(‘a:blip’) }” ) ; .get( qn(“r:embed”) ) #獲取 屬性名 ‘r:embed’ 的 屬性值(如: ‘rId4’) ; lxml.etree._Element.xpath( “//a:blip/@r:embed”, namespaces = NS) #/@r:embed = 獲取 屬性名 ‘r:embed’ 的 屬性值(如: ‘rId4’),使用.findall() 要先.findall()獲取List[_Element],再迴圈_Element.get()獲取屬性值, .xpath() 第一個參數path 使用”//a:blip/@r:embed” ,可直接獲取屬性值(List[str]如: [‘rId4’, ‘rId5’]) ; 如何對docx真實移除圖片瘦身? Python 讀取 DOCX 圖片關聯:qn+find/findall 與 XPath 的實戰對照 from lxml import etree ; from docx.oxml.ns import qn; lxml.etree._Element.findall( f”.//{ qn(‘a:blip’) }” ) ; .get( qn(“r:embed”) ) #獲取 屬性名 ‘r:embed’ 的 屬性值(如: ‘rId4’) ; lxml.etree._Element.xpath( “//a:blip/@r:embed”, namespaces = NS) #/@r:embed = 獲取 屬性名 ‘r:embed’ 的 屬性值(如: ‘rId4’),使用.findall() 要先.findall()獲取List[_Element],再迴圈_Element.get()獲取屬性值, .xpath() 第一個參數path 使用”//a:blip/@r:embed” ,可直接獲取屬性值(List[str]如: [‘rId4’, ‘rId5’]) ; 如何對docx真實移除圖片瘦身?](https://i0.wp.com/savingking.com.tw/wp-content/uploads/2025/11/20251119130848_0_3fbf6b.png?quality=90&zoom=2&ssl=1&resize=350%2C233)







近期留言