file = open("example.txt", "w") file.write("Hello, world!") file.close() In this example, we open a file called example.txt in write mode ( "w" ), write the string "Hello, world!" to it, and close the file.
For example:
”`python colors = (“red”, “green”, “blue”) print(colors[0]) # Output: red
For example: