python encode string code example
Example 1: how to encrypt a string python
from cryptography.fernet import Fernet
message = "my deep dark secret".encode()
f = Fernet(key)
encrypted = f.encrypt(message)
Example 2: python parse string
msg = "hi#my#name#is#alon"
msg = msg.split("#")
print(msg)
#output: ["hi", "my", "name", "is", "alon"]
Example 3: python string format
print("My name is {0} and I am {1} years old".format(name, age))