Last active
January 2, 2016 06:49
-
-
Save motoso/8265926 to your computer and use it in GitHub Desktop.
【Python】[ブース] [サークル名]の項目が並んだテキストファイルからサークル名のみを抽出したテキストファイルを作成するプログラム.コミティアのサークル名簿( http://www.comitia.co.jp/100/100list.html )からサークル名を抜き出すために作成.このあと,むちゃくちゃ形態素解析した.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding: UTF-8 | |
| import sys | |
| argv = sys.argv | |
| argc = len(argv) | |
| if (argc < 3): | |
| print "Usage: # python %s [input] [output]" % argv[0] | |
| quit() | |
| try: | |
| file = open(argv[2],"w") | |
| except IOError: | |
| print "Error: file can not open." | |
| except: | |
| print "Unexpected error." | |
| for line in open(argv[1], "r"): | |
| itemList = line.split(" ",1) # Only first space is considerable | |
| (address, name) = tuple(itemList) | |
| # print name | |
| file.write(name) | |
| file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment