Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- # Filename: to_lowercase.py
- # Version: 1.0.0
- # Author: Jeoi Reqi
- """
- Description:
- This script converts input text to Lowercase format.
- Requirements:
- - Python 3.x
- Functions:
- - to_lowercase(text): Converts input text to Lowercase format.
- Parameters:
- text (str): The input text to be converted.
- Returns:
- str: The text converted to Lowercase format.
- Usage:
- Run the script and provide the text you want to convert when prompted.
- The converted text will be saved to "converted_lowercase.txt" in the same directory as the script.
- Example Output:
- Input Text: "This is a Test of Case Converting"
- Converted Text Has Been Saved To: 'converted_lowercase.txt'.
- Converted Text:
- this is a test of case converting
- """
- def to_lowercase(text):
- """
- Convert a given string to Lowercase format.
- Parameters:
- text (str): The input string.
- Returns:
- str: The Lowercase converted string.
- """
- return text.lower()
- def main():
- """
- Main function to prompt user input and convert the text to Lowercase.
- The converted text is saved to a file.
- """
- input_text = input("Enter the text you want to convert to Lowercase: ")
- lowercase_text = to_lowercase(input_text)
- with open("converted_lowercase.txt", "w", encoding="utf-8") as file:
- file.write(lowercase_text)
- print("\nConverted Text Has Been Saved To: 'converted_lowercase.txt'.\n")
- print("Converted Text:\n")
- print(f"\t\t{lowercase_text}")
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement