Python3.6.3チュートリアル写経20171116

6.1.2. モジュール検索パス~7.2.2. jsonによる構造化されたデータの保存 をやった。

  • パッケージはディレクトリ、モジュールは.pyファイル
  • パッケージのディレクトリには、__init__.pyを置く(空でもよい)
  • ファイル入出力のモードには以下がある

"r", "rb", "r+", "rb+", "w", "wb", "w+", "wb+", "a", "ab","a+", "ab+"

f = open('test.txt', 'r')
for line in f:
    print(line, end=' ')
f.close()