私はWindowsターミナルでPythonプログラムを実行すると、挿入された変数(%s
)のテキストがうまくいきません。cmdの入力に問題があります
コード:
print("Hi! What's your name?")
name = input("name: ")
print("Nice to meet you %s" % name)
print("%s is a good name." % name)
print("This line is only to test %s in the middle of the text." % name)
input("press enter to exit")
Pythonシェルでの結果:CMDで
結果:
私はケースでWindows 10およびpython32を使用していますあなたは知る必要があった。
興味深いことに、 '%'の代わりに 'format'を使用して結果を投稿してください。 – Rockybilly
Win8.1でうまく動作します。私はWindowsのコマンドラインから実行し、出力はあなたのPythonシェルの結果と似ています。 –
窓の下で私のために働く –