import base64
def main():
    # Read the input string from the user.
    data = input("Enter the text you want to encode: ")
    # Encode the string using base64 encoding.
    encoded_data = base64.b64encode(data.encode())
    # Print the result.
    print("Encoded Data:", encoded_data)
if __name__ == '__main__':
    main()
Save this code in a file, for example base64_encoder.py, and run it using Python interpreter:
| python python base64_encoder.py | 
Replace the input text with your desired string to encode into base64 format.
