Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def split(s):
- """split(s) -> list of strings
- Return a list of the decoded netstrings in s.
- """
- v = {'0':0,'1':1,'2':2,'3':3,'4':4,'5':5,'6':6,'7':7,'8':8,'9':9}
- retval = []
- string = s
- cc = 0
- while cc < len(string):
- i = cc
- n = 0
- ch = string[i]
- while ch != ":":
- n = n * 10 + v[ch]
- i += 1
- ch = string[i]
- parsed = string[i+1:i+1+n]
- retval.append(parsed)
- cc = i + n + 1 + 1
- return retval
Add Comment
Please, Sign In to add comment