DevOps Articles

Curated articles, resources, tips and trends from the DevOps World.

Yet More Python for Beginners: Saving Input to a File

3 years ago thenewstack.io
Yet More Python for Beginners: Saving Input to a File

Summary: This is a summary of an article originally published by The New Stack. Read the full original article here →

So far in this introductory series to the https://www.python.org/, we’ve learned some pretty cool basic Python tricks. We’ve learned https://thenewstack.io/an-introduction-to-python-for-non-programmers/, learned about the https://thenewstack.io/more-python-for-non-programmers/, and learned how to accept input from users.

The first thing we add to the file is the line to indicate we’re opening the text.txt file in write-only mode.

What we’ve done here is define the variable file1 with the function that opens the text.txt file in write mode.

If you view the contents of the text.txt file, you’ll see it contains the Hello, New Stack line at the top.

Made with pure grit © 2024 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com