編寫一個 Python 程序,使用字符串格式打印元組。以下是使用字符串格式打印元組項的方法。
# Print Tuple using string formatting
numTuple = (20, 40, 60, 80, 100, 120, 140)
print(numTuple)
print("Tuple Items are = {0}".format(numTuple))
print("Tuple Items are = %s" %(numTuple,))
print("Tuple Items are = %s" %(numTuple))
原創文章,作者:簡單一點,如若轉載,請註明出處:https://www.506064.com/zh-hk/n/127694.html