-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
51 lines (44 loc) · 967 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -*- coding:utf-8 -*-
"""
Project: VJSpider
Version: 20181207
Compatible: CodeMaster / VJCore
Author: John Zhang
"""
import os
import sys
import getopt
import requests
from bs4 import BeautifulSoup
ojs=[]
def traverse(f):
global ojs
fs = os.listdir(f)
for f1 in fs:
tmp_path = os.path.join(f,f1)
if os.path.isdir(tmp_path):
print("- " + f1)
ojs.append(f1)
def main(argv):
global ojs
print("----- available online judeges -----")
print()
traverse("oj/")
print()
print("------------------------------------")
print()
OJ = input("OJ: ")
if not OJ in ojs:
print("\nfailed")
return
Prob = input("Problem: ")
try:
ret=os.system("python OJ/" + OJ + "/" + OJ + ".py -p "+Prob)
except:
ret=-1
if ret==0:
print("successful")
else:
print("failed")
if __name__ == '__main__':
main(sys.argv[1:])