to01 function added

master
Andrey Prokhorov 5 years ago
parent aed26d2117
commit 36d3799e81

@ -42,10 +42,17 @@ class SBA:
def __len__(self): def __len__(self):
return self._size return self._size
def to01(self):
return "".join([str(self.__getitem__(x)) for x in range(self._size-1, -1, -1)])
if __name__ == "__main__": if __name__ == "__main__":
s = SBA(16) s = SBA(16)
print(s[1]) print(s[1])
s[1] = 1 s[1] = 1
print(s[1]) print(s[1])
print(len(s)) print(len(s))
print(s[16]) try:
print(s[16])
except Exception as e:
print(e)
print(s.to01())
Loading…
Cancel
Save