テキストファイルへの書き込み処理はFileオブジェクトの以下のメソッドを用いる。 write() – 文字列を引数に取り、ファイルに書き込む。 writelines() – シーケンス型を引数に取り、ファイルに書き込む。 write() – 文字列を引数に取り、ファイルに書き込む ソースコード #!/usr/bin/python # coding: UTF-8 # 書き込む文字列 str1 = """It is meaningless only to think my long further aims idly. It is important to set my aims but at the same time I should confirm my present condition. Unless I set the standard where I am in any leve
![Python: テキストファイルに書き込み – write()、writelines()メソッド](https://cdn-ak-scissors.b.st-hatena.com/image/square/252c967a24c40bf8f7a03dee6705872ef2f3bb44/height=288;version=1;width=512/https%3A%2F%2Fyukun.info%2Fwp-content%2Fuploads%2F2013%2F08%2Fpython_unix_char_code.png)