Forums
python 使用 空格 或是 <tab> 來區分程式裡面的區塊,如同c語言裡的 { } - Printable Version

+- Forums (https://zhtw.com/f)
+-- Forum: 分類 (https://zhtw.com/f/forumdisplay.php?fid=1)
+--- Forum: 程式語言 Programming language (https://zhtw.com/f/forumdisplay.php?fid=9)
+---- Forum: python (https://zhtw.com/f/forumdisplay.php?fid=17)
+---- Thread: python 使用 空格 或是 <tab> 來區分程式裡面的區塊,如同c語言裡的 { } (/showthread.php?tid=53)



python 使用 空格 或是 <tab> 來區分程式裡面的區塊,如同c語言裡的 { } - admin - 2025-06-24

c 語言的區塊
碼:
if ( a > 1) {
    printf("hi\n");
    printf(" ... \n");
}
C 也可以寫成一整行
if ( a > 1) {  printf("hi\n");    printf(" ... \n");  }

python 的表示方式
碼:
if a>1 :
  print("hi")
  print(" ... ")

python 不可以寫成一整行