Tag Archives: File

Python: ファイル、ディレクトリの属性確認(存在、読み込み、書き込み、実行)

ソースコード $ python >>> import os >>> os.access(‘/root’, os.F_OK) True >>> os.access(‘/root’, os.R_OK) False >>> o … Continue reading

Posted in Python | Tagged , | Leave a comment

Python: CSVファイルに書き込み – csv.writerオブジェクト

試しにチャット履歴をCSVファイルに保存するという場合の例を取り上げます。まぁ実際はメッセンジャーアプリのXMLファイル等をコンバートして保存する例を持ってきた方が良いのかもしれませんが、そうするとコードが長くなり今記事 … Continue reading

Posted in Python | Tagged , , , | 2 Comments

Python: CSVファイルの読み込み – csv.readerオブジェクト

ソースコード #!/usr/bin/python # coding: UTF-8 # CSVファイルの読み込み import csv filename = “table01.csv” csvfile = open(fil … Continue reading

Posted in Python | Tagged , , , | 3 Comments

Python: テキストファイルの読み込み – read()、readlines()、readline()メソッド

以下の読み込み用テキストファイルを用いて、 text.txt It is meaningless only to think my long further aims idly. It is important to s … Continue reading

Posted in Python | Tagged , , | 2 Comments