IN PYTHON I want a program that prints a text file and cleans a sequence of letters that are repeated in the program. Then, print only the unique letters or words
THIS IS THE TEXT FILE: https://courses.alrodrig.com/4932/dubstep.txt
I want to eliminate the words BOOTYBOUNCE and print the other word
****This requires some effort so please drop a like if you are satisfied with the solution****
I have satisfied all the requirements of the question and for your convenience I'm providing the code and output in three versions like code 1, code 2, code 3
Code 1 is is get the input from user and print the output
Code 2 is for reading the input from a text file (" input.txt ") and print the output on screen
Code 3 is for reading the input from a text file (" input.txt ") and write the output on another text file (" result.txt ") so Happy Chegging!!!
Code 1:
import re
content = input()
words = re.split("BOOTY|BOUNCE", content)
temp = []
for word in words:
if word != '':
temp.append(word)
resultString = " ".join(temp)
print(resultString)
Output and code Screenshot:

Code 2:
import re
# this is the path of file on my desktop, change it to any path
you want
file = "C://Users/THE__INFINITY/Desktop/input.txt"
f = open(file, 'r')
content = f.read()
print(content)
words = re.split("BOOTY|BOUNCE|\\n", content)
temp = []
for word in words:
if word != '':
temp.append(word)
resultString = " ".join(temp)
print(resultString)
Output and code screenshot:

File " input.txt ":

This is the big input you gave me in the question.....
Code 3:
import re
# this is the path of file on my desktop change it to any path
you want
file = "C://Users/THE__INFINITY/Desktop/input.txt"
f = open(file, 'r')
content = f.read()
print(content)
words = re.split("BOOTY|BOUNCE|\\n", content)
temp = []
for word in words:
if word != '':
temp.append(word)
resultString = " ".join(temp)
# this is the path to save result file (result.txt) on my desktop,
change it to any path you want
outputFile="C://Users/THE__INFINITY/Desktop/result.txt"
o=open(outputFile,'w+')
o.write(resultString)
Output and code Screenshot:

Files " input.txt " and "result.txt"
****Note result.txt file is obtained or created after execution of the above code...

IN PYTHON I want a program that prints a text file and cleans a sequence of...
Write a program that inputs a text file. The program should print the unique words in the file in alphabetical order. Note: The sort function sorts first numbers, then capital letters, then lowercase letters. That is fine for this assignment as you can see from the sample output. But even if the same word appears multiple times in the file it should only be displayed once in the output. (python)
IN PYTHON 3: Write a Python program to read the attached text file containing words, count the occurrence of each unique word and store the words in alphabetical order in a text file listing the word and the total count of that word. You cannot use any advanced features such as dictionaries. The program requires user input to determine the name of the file. (example of the text file that needs to be read = for a brief moment I...
Python 3:Write a program that inputs a text file. The program should print the unique words in the file in alphabetical order. Write a program that inputs a text file. The program should print the unique words in the file in alphabetical order An example file along with the correct output is shown below: example.txt the quick brown fox jumps over the lazy dog Enter the input file name: example.txt brown dog fox jumps lazy over quick the
I cant get this python program to read all the unique words in a file. It can only read the number of the unique words in a line. import re import string from collections import Counter # opens user inputted filename ".txt" and (w+) makes new and writes def main(): textname = input("Enter the file to search: ") fh = open(textname, 'r', encoding='utf-8' ) linecount = 0 wordcount = 0 count = {} print("Sumary of the", fh) for line in...
Python: The attached text file: https://drive.google.com/open?id=1Hcj4Ey4NbKHn5-vyF-foR3iny0aX8y1c Unique Words Write a program that opens a specified text file and then displays the number of unique words in the text file after stripping all the white spaces, comma, and the punctuation marks and a list of all the unique words found in the file. The list should be sorted in alphabetical order. The program should handle the ‘file not found’ error. Store each word as an element of list. Be sure not...
Write a Python program stored in a file q6.py that takes a text (without punctuation) as input and prints the number of occurrences of each word. Your program is case-insensitive, meaning that uppercase and lowercase of the same letter is considered the same. Printing should be done in decreasing order of the number of occurrences. If several words have the same number of occurrences, they should be printed in alphabetical order. A new line must be printed between the words...
Python 3 Write a program that reads a sequence of words and prints every word whose frequency is equal to its length. You can assume that there will always be a word that meets this condition. If more than one word have this condition, you must print first the most frequent one. If two or more words with equal frequencies meet this condition, print them from the smallest to the largest in alphabetical order. Sample Input lee john lee peter...
(Python 3) Write a program that reads the contents of a text file. The program should then create a dictionary in which the keys are individual words found in the file and the values are the number of times each word appears and a list that contains the line numbers in the file where the word (the key) is found. Then the program will create another text file. The file should contain an alphabetical listing of the words that are...
Write a Python program to read lines of text from a file. For each word (i.e, a group of characters separated by one or more whitespace characters), keep track of how many times that word appears in the file. In the end, print out the top twenty counts and the corresponding words for each count. Print each value and the corresponding words, in alphabetical order, on one line. Print this in reverse sorted order by word count. You can assume...
write a python program that prompts the user for a name of a text file, opens that file for reading , and tracks the unique words in a file and counts how many times they occur in the file. Your program should output the unique words and how often they occur in alphabetical order. Negative testing for a file that does not exist and an empty file should be implemented.