簡體   English   中英

如何消除Label中的花括號(text =)

[英]How to eliminate curly braces in Label (text=)

如何消除“共有”和“字典中的條目”周圍的花括號

在此處輸入圖片說明

self.status_bar = Label(self.status_bar, text=("There are total", len(dictionary_data), "entries in dictionary."), bg="yellow", relief=FLAT)

問題是您當前正在為text參數傳遞一個元組。 相反,您應該傳遞一個字符串。 您可以使用str.format將字典長度插入此字符串中:

self.status_bar = Label(self.status_bar, text="There are total {} entries in dictionary.".format(len(dictionary_data)), bg="yellow", relief=FLAT)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM