Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
mod.py:
def addone(number): result = number + 1
test.py:
import mod print mod.addone(2)
私が得た結果はNoneであるため、結果変数が欠落していると推測しています。私のコードに欠けているもの。
None
はい、これはモジュールなしで簡単に実行できることを知っています。これは単なる例です。
結果を返さないmod.pyのメソッドであるインポート権を実行しています。への変更:
def addone(number): return number + 1
add_oneに「return」がないため、Noneになります