1 Star 8 Fork 4

不懂d叛逆/pyccjh

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ccjhObj.py 756 Bytes
一键复制 编辑 原始数据 按行查看 历史
不懂d叛逆 提交于 2015-02-06 17:03 +08:00 . \r\n替换为\n
# -*- coding: utf-8 -*-
'''
Created on 2013-5-30
基础物品类
@author: 不懂d叛逆
'''
def split(string):
temp = string.split("&")
r = {}
for t in temp:
if len(t) > 0:
pos = t.find("=")
if pos != -1:
r[t[:pos]] = t[pos + 1:]
return r
class ccjhObj():
def __init__(self, data = None):
if data:
self.data2 = data
self.data = split(data)
else:
self.data = {}
self.data2 = ""
return
def get(self, key):
if key in self.data:
return self.data[key]
else:
return ""
def setTo(self, obj):
if isinstance(obj, ccjhObj):
self.data.update(obj.data)
elif isinstance(obj, str):
self.data.update(split(obj))
return
def getType(self):
return int(self.get("C"))
def ToString(self):
return self.data2
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/panlizzx/pyccjh.git
git@gitee.com:panlizzx/pyccjh.git
panlizzx
pyccjh
pyccjh
master

搜索帮助