code :
for i in range(1, 5):
s = "{0:>" + str(i) + "}"
print(i, s, s.format("*") )
output :
1 {0:>1} *
2 {0:>2} *
3 {0:>3} *
4 {0:>4} *
問題 '*'前為何會有空白一直增加
網路上查到format的用法都是 像printf來格式化自己要的排版
上例中直接把字串format後面給符號不太清楚是什麼意思 希望有人能幫我解惑一下
另外 問一個vim的小問題
我用set noai來取消貼上自動縮排好像沒有 不知道為何
所以改用r!cat
然後貼上內容再ctrl+D就行了
但是r!cat是什麼意思呢
!後面加指令 來cat等待輸入我應該知道
但是r是我就不清楚了
以上,謝謝大家。