LoginSignup
4
3

More than 5 years have passed since last update.

AtCoderを高速で始められるスクリプト書いたよ!

Posted at

コマンドラインからでコンテスト名のディレクトリとa.py, b.py, c.py, d.pyを保存する。

使い方(例)

※arc021の部分は各コンテスト名に対応
1. コマンドラインでpython start_atcoder.py arc021ターン!
2. 実行したディレクトリにarc021が出来る。
3. arc021の中にはa.py, b.py, c.py, d.pyが作られている。
4. ファイルを作る手間が省ける!

import os
import sys

def main():
    argvs = sys.argv
    argc = len(argvs)

    if argc < 1:
        print('Usege\nstart_atcoder.py contest_name')
        exit(0)
    contest_name = argvs[1]
    if os.path.exists(contest_name):
        print(contest_name, 'is exists.')
    else:
        os.mkdir(contest_name)
        print(contest_name, 'is created.')

    problem_number = 4 
    for i in range(problem_number):
        path = contest_name+'\\'+chr(ord('a')+i)+'.py'
        if os.path.isfile(path):
            print(path, 'is exists')
        else:
            f = open(path,'w')
            f.close()
            print(path, 'created')

if __name__ == '__main__':
    main()
4
3
0

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
4
3