示例#1
0
import os

abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)


def run():
    return game.run()


if __name__ == "__main__":
    parser = ConfigParser(config=config,
                          prog="main.py",
                          description="rewind client for bomberman")
    parser.parse()

    if not config.is_replay:
        win_count, win_avg_diff = 0, 0
        lose_count, lose_avg_diff = 0, 0
        draw_count = 0

        stat = {
            'me_alive, ene_alive': {
                'win': 0,
                'lose': 0,
                'draw': 0
            },
            'me_alive, ene_dead': {
                'win': 0,
                'lose': 0,
示例#2
0
# -*- conding: utf-8 -*-
# @Time    : 2018/6/21 15:45
# @Author  : Elvis Jia
# @Description: parser test

from config import ConfigParser
import requests

if __name__ == "__main__":
    configParser = ConfigParser('config.txt')
    rootBlock = configParser.parse()

    # Test read html file
    with open('test.htm', 'rb') as reader:
        content = reader.read().decode('utf-8')
        result, stop = rootBlock.search(content, 0, len(content))
        print 'test html:', result

    # Test download html
    url = 'https://mall.kaola.com/search.html?shopId=15662189'
    content = requests.get(url, verify=False).text
    result, stop = rootBlock.search(content, 0, len(content))
    print 'test html downloaded:', result