LoginSignup
2
2

More than 5 years have passed since last update.

ファイルの中身を読むpythonスクリプトのテンプレ

Last updated at Posted at 2015-07-09
readLine
import sys 
import os.path

argvs = sys.argv #引数リスト
argc = len(argvs)

if (argc != 2):
    print 'args must to be 2' 
    quit()

if not (os.path.isfile(argvs[1])):
    print 'no such file: ' + argvs[1]
    quit()

f = open(argvs[1])

for line1 in f:
    # 処理
f.close()

2
2
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2