[英]% operator in python used in print function
color_list = ["Red","Green","White" ,"Black"]
print( "%s %s"`%(color_list[0],color_list[-1])`)
% 運算符在 python 中引用了什么。 使用的目的是什么?
查看官方python文檔
String Formatting
s % obj
mod(s, obj)
https://docs.python.org/3/library/operator.html
並且不要將它與模運算符混淆
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.