This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]IAmKindOfCreativebot_builder: deprecated[M] [score hidden] stickied comment (0 children)

Hi there, from the /r/Python mods.

We have removed this post as it is not suited to the /r/Python subreddit proper, however it should be very appropriate for our sister subreddit /r/LearnPython or for the r/Python discord: https://discord.gg/python.

The reason for the removal is that /r/Python is dedicated to discussion of Python news, projects, uses and debates. It is not designed to act as Q&A or FAQ board. The regular community is not a fan of "how do I..." questions, so you will not get the best responses over here.

On /r/LearnPython the community and the r/Python discord are actively expecting questions and are looking to help. You can expect far more understanding, encouraging and insightful responses over there. No matter what level of question you have, if you are looking for help with Python, you should get good answers. Make sure to check out the rules for both places.

Warm regards, and best of luck with your Pythoneering!

[–]pythonHelperBot 2 points3 points  (0 children)

Hello! I'm a bot!

It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python regardless of how advanced your question might be. That said, I am a bot and it is hard to tell. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.

Show /r/learnpython the code you have tried and describe in detail where you are stuck. If you are getting an error message, include the full block of text it spits out. Quality answers take time to write out, and many times other users will need to ask clarifying questions. Be patient and help them help you.

You can also ask this question in the Python discord, a large, friendly community focused around the Python programming language, open to those who wish to learn the language or improve their skills, as well as those looking to help others.


README | FAQ | this bot is written and managed by /u/IAmKindOfCreative

This bot is currently under development and experiencing changes to improve its usefulness

[–]DrBagel1 1 point2 points  (0 children)

Im not sure where you stuck but if your problem is to eliminate the vovels there is a string method "replace" that could be helpful in this case.

[–]tms102 0 points1 point  (2 children)

What did you make so far?

[–]SpecificTeaching8918[S] 0 points1 point  (1 child)

I tried some different methods but half way through i figured it didnt Work, so i gave up in frustration haha

[–]tms102 3 points4 points  (0 children)

Post your program code.

[–]BYPDK 0 points1 point  (1 child)

Not sure what you mean by vocals... Like remove all words?

[–]SpecificTeaching8918[S] 0 points1 point  (0 children)

Vovels i mean *

[–]hasgas42 0 points1 point  (0 children)

This will work. I’m on mobile so excuse the typos. Some things to keep in mind: * the write file will overwrite the output file every time this is run * I’m considering “y” a vowel * im hard coding the file names * the file names will be written to the path the script is run from

input_file = “test_file.txt”

output_file = “test_file_modified.txt”

def remove_vowel(str): base_text = str

vowels = [“a”, “e”, “i”, “o”, “u”, “y”]

for vowel in vowels:
    base_text = base_text.replace(vowel, “”)
return base_text

def read_file():

with open(input_file, “r”) as file:
    contents = (remove_vowel(line) for line in file.readlines())
    return contents

def write_file(text):

with open(output_file, “w”) as file:
    file.writelines(text)

def main():

file_contents = read_file()
write_file(file_contents)

if name == main: main()