ソースを参照

Added a second example on print formatting.

Gogs 7 年 前
コミット
cc43b6c397
1 ファイル変更1 行追加1 行削除
  1. 1 1
      examples/simplefunction.py

+ 1 - 1
examples/simplefunction.py

@@ -2,7 +2,7 @@ def example(firstargument, secondargument, thirdargument="N/A"):
     """ Prints a string based on the two arguments. """
     # This is python3.6 syntax:
 #    print(f"{firstargument} is the first argument.")
-    print("{} is the first argument.".format(firstargument))
+    print("{a} is the first argument.".format(a = firstargument)) # Name the argument if you want
     print("{} is the second argument.".format(secondargument))
     print("{} is the third argument.".format(thirdargument))