Python Basics - 28 part 1 - Check if Specific Words Exist in A File

  Рет қаралды 63,260

HYPED247

HYPED247

Күн бұрын

Пікірлер: 45
@pardener
@pardener 2 жыл бұрын
Awesome tutorial im very slow at typing so i never had to pause and look back at it and the program was Really Really simple
@ragegod6663
@ragegod6663 5 жыл бұрын
Man i would like to thank you and keep doing your job. Really amazing got me out of my little chaotic world.
@SamA-jg8vy
@SamA-jg8vy 2 жыл бұрын
Great tutorial! Very well put together and clearly explained. Thanks for sharing this. I'll be watching your other tutorials as well.
@barbarasais9683
@barbarasais9683 Жыл бұрын
Thanks, it was super easy to follow!!
@antejurcevic5855
@antejurcevic5855 6 жыл бұрын
Why is it important to put "mo" in squared brackets?
@hyped2476
@hyped2476 6 жыл бұрын
Good question. It is because we need to pass 'mo' as an element of a list.
@alexromero4525
@alexromero4525 3 жыл бұрын
Thanks for making this, just used it in 2021!
@hyped2476
@hyped2476 3 жыл бұрын
Right on, Alex!
@MrJestriktheJester
@MrJestriktheJester 3 жыл бұрын
@@hyped2476 Wow this video was posted 5 yrs ago?!?
@rudrashiva
@rudrashiva 5 жыл бұрын
without using def. and if function>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>string = open("file_name.txt","r") x = (string.read()).lower() y = x.split().count(input("Enter the word: ")) print(y)
@yougiovesjotube
@yougiovesjotube 4 жыл бұрын
string is not defined
@tobiashaller9479
@tobiashaller9479 3 жыл бұрын
Hey man nice tutorial How would I search for a term that consists of two words for example "Joint Venture" or "European Union"?
@hyped2476
@hyped2476 3 жыл бұрын
That is a good question! I do not think that our current program accounts for this edge case. We would have to create another program to do the thing that you want.
@strexli4835
@strexli4835 3 жыл бұрын
your video is incredible thanks you a lot !
@anthonyczuchaj5912
@anthonyczuchaj5912 4 жыл бұрын
have been trying for a couple of days to get the items in a txt file to be compared with the words in an input bar but it seems to not registering if the words match or not any suggestions?
@marysanchez8878
@marysanchez8878 4 жыл бұрын
Cheers for this, been searching for "andrea fulton solo ads" for a while now, and I think this has helped. Have you ever come across - Yanliana Feydalyn Rule - (do a search on google ) ? Ive heard some super things about it and my partner got cool results with it.
@emilgregersen3507
@emilgregersen3507 4 жыл бұрын
You should consider not doing to much in your videos. Your title is "Check if Specific Words Exist in A File" but what you actually did was: "How to count how many times a specific word exists in a file, while also making sure that your program understands it no matter how the word is written and also takes out any signs that we are not looking for" This is not Python for basics. Your title indicates a video that is python for basics, but you decided to do much more "just because" - it confuses the viewer more than it helps.
@hyped2476
@hyped2476 4 жыл бұрын
Hi Greg, thank you for this. I appreciate your honest reply.
@emilgregersen3507
@emilgregersen3507 4 жыл бұрын
@@hyped2476 No worries. Was stressed when I wrote the comment, sorry for the angry tone.
@eric9973
@eric9973 4 жыл бұрын
Thanks sir. Is this applicable to Msword file too?
@bhavindedhia9968
@bhavindedhia9968 5 жыл бұрын
sir I want to check for multiple words to check what to do
@hyped2476
@hyped2476 5 жыл бұрын
Easy. All you have to do is to add the words that you want to check in the list. In line 22, I only have ["mo"] but you can add all the words that you want. For example, ["word1", "word2", ""]
@alkadedhia2498
@alkadedhia2498 5 жыл бұрын
@@hyped2476 Sir but if I want to go for input user it doesn't work, I had tried with .split() but didn't work. For eg I want to search keyword for multiple words than with user input what will code do help?
@lucijakrusic2278
@lucijakrusic2278 4 жыл бұрын
@@hyped2476 Hi, what if I wanted to check words from another txt file?
@hyped2476
@hyped2476 4 жыл бұрын
@@lucijakrusic2278 Just change the name of the file from "mo.txt" to the file that you would like to count. For example, "newFile.txt".
@lucijakrusic2278
@lucijakrusic2278 4 жыл бұрын
@@hyped2476 Hi, thank you for your reply, but I was unclear - if I wanted the "listwords" to actually be a txt file which contained a list of words, where would I need to put the function for reading that file?
@shubhamjha6652
@shubhamjha6652 6 жыл бұрын
if i want get line number of a word in a text file which has multiple lines, how will i get it? (eg: "ronaldo" in line 1, line 5 .....). pls help
@hyped2476
@hyped2476 6 жыл бұрын
Hi there, hmm. Well, if I were to do it, then I would use a counter. You need to track the line number that you're currently on, and when you print the word, you should print the number as well. Here is the most up to date version of the program: github.com/Hyped-247/FileCounter/blob/master/counterFile.py
@shubhamjha6652
@shubhamjha6652 6 жыл бұрын
can i use a list instead of a dictionary here?
@hyped2476
@hyped2476 6 жыл бұрын
Try it out, and let me know what happens. @@shubhamjha6652
@shubhamjha6652
@shubhamjha6652 6 жыл бұрын
@@hyped2476 hi, i tried and it worked. btw i am facing issues when reading the next line after the line in which the pattern is found.
@mrmister.101
@mrmister.101 4 жыл бұрын
how do u make it so it opens a pdf?
@hyped2476
@hyped2476 4 жыл бұрын
I do not think this will work on a PDF. In this video, it will only work with a text file.
@RayCharles444
@RayCharles444 7 жыл бұрын
thanks for the video, I'm having a bit of trouble reading the font on the screen, do you by chance have a txt file of this? Thanks!!
@hyped2476
@hyped2476 7 жыл бұрын
I just looked for some old files and upload it on GitHub just for you. Here is the link: github.com/Hyped-247/file
@Battrisha
@Battrisha 5 жыл бұрын
This guy is like the Bob Ross of coding
@MCCiabattaGrande
@MCCiabattaGrande 6 жыл бұрын
Man I LOVE U #nohomo
@hyped2476
@hyped2476 6 жыл бұрын
You will love me more after this: github.com/Hyped-247/TK/tree/master/File%20Counter
@tamilmaranc
@tamilmaranc 5 жыл бұрын
excellent
@CollosalTrollge
@CollosalTrollge 4 жыл бұрын
Subscribed and liked this video - will be checking your Python stuff out - i hope i manage to get what i want - not so complicated but i am making it harder for myself overthinking, Thanks
@SinaAfshariJewellsMuseum
@SinaAfshariJewellsMuseum 4 жыл бұрын
Fuckkkking goood r u😵
10 Important Python Concepts In 20 Minutes
18:49
Indently
Рет қаралды 454 М.
Как Ходили родители в ШКОЛУ!
0:49
Family Box
Рет қаралды 2,3 МЛН
If __name__ == "__main__" for Python Developers
8:47
Python Simplified
Рет қаралды 420 М.
using python re module to process text files part1
14:15
Computational Linguistics @ Illinois
Рет қаралды 39 М.
My 10 “Clean” Code Principles (Start These Now)
15:12
Conner Ardman
Рет қаралды 318 М.
Writing Code That Runs FAST on a GPU
15:32
Low Level
Рет қаралды 577 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
How to Read a Record From a File With Python
7:50
Max O'Didily
Рет қаралды 759
"Clean" Code, Horrible Performance
22:41
Molly Rocket
Рет қаралды 942 М.
5 Python Libraries You Should Know in 2025!
22:30
Keith Galli
Рет қаралды 87 М.
WHAT Is "Glob" In Python?! (It's Actually Very Useful!)
11:15
Python Tutorial: File Objects - Reading and Writing to Files
24:33
Corey Schafer
Рет қаралды 1,8 МЛН