Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This is the "plugin" file to be executed. Copy and paste it as "amazingPlugin.py"
- # It expects the variables: 'data' (string) and 'result' (dictionary)
- # 'result' will contain the entries 'first_char', 'last_char', 'length'
- result["first_char"] = data[0]
- result["last_char"] = data[-1]
- result["length"] = len(data)
- #---------------------------------------------------------------------------------------
- # This is the demo code. Copy and paste it as a different .py file in the same directory
- s = "Hello plugin!"
- with open("amazingPlugin.py") as f:
- plugin = f.read()
- f.close()
- return_dict = {"data": s, "result" : {}}
- try:
- exec(plugin, {}, return_dict)
- except:
- print("something bad happened!")
- print("Plugin processing result:", return_dict)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement