Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # @skate702 das ist genau das was du im stream mit noah versucht hast nur in python statt in scala
- ## tut mir leid dich belästigt zu haben wenn es dich nicht interessiert.
- def parse(cmd):
- if cmd[:4] == "abc\/" and cmd[4] != " ":
- print cmd
- cmd2 = cmd[4:].split(" ")
- #for i in cmd2: print i
- print "preamble: " + cmd[:4]
- print "command: " + cmd2[0]
- print "args: " + str(cmd2[1:])
- elif cmd[:3] == "abc" and cmd[3] != " " and cmd[4] != " ":# <--just to be sure
- cmd2 = cmd[3:].split(" ")
- print cmd
- #for i in cmd2: print i
- print "preamble: " + cmd[:3]
- print "command: " + cmd2[0]
- print "args: " + str(cmd2[1:])
- else:
- print "invalid command '%s', please check" %cmd # <--was first a ¨raise SyntaxError¨, which would stop the script completely
- if __name__ == '__main__':
- # test if it works
- parse("abctime set 0")
- parse("abc/time set 0")
- parse("time set 0")
- parse("/time set 0")
- parse("abc time set 0")
- parse("abc/ time set 0")
Advertisement
Add Comment
Please, Sign In to add comment