Lecture 7 : File Input/Output in Python

preview_player
Показать описание
This lecture was made with a lot of love❤️

Рекомендации по теме
Комментарии
Автор

00:01 Today we will cover Chapter Seven about file operations.
02:07 RAM is volatile memory and not suitable for permanent storage
06:02 Using physical files in day-to-day operations
08:25 Opening a file in read mode returns a text IO wrapper
13:18 Understanding file reading modes
15:23 Reading a file and printing its contents
19:13 Appending data to a file in A mode
21:17 Differences between different modes
25:09 Different file modes in Python: Read Plus, Write Plus, Append Plus
27:19 Using the 'with' syntax in Python automatically closes the file
31:48 We can delete any file by using the remove function in the os module.
34:24 Replace Java with Python in a file using the replace method.
38:59 Write a function to find the line number of the word 'learning' in a file.
41:02 The code checks if a word exists within a given data string and prints the line number if it does.
45:28 Extract individual numbers from a string and convert them to integers
47:20 The code splits a string of numbers separated by commas and prints them individually.

premsharma
Автор

Shradha di please cover all the Topics from 0 to 100 and please start DSA with Python 🙏

ayushyadavone
Автор

Mam! this line is very motivational for me that you mentioned in start that "All power is within you you can do anything and everything"

abdullahbut
Автор

Ma'am, The vs code is showing empty lines in output even when using the read() function for the first time. what's the reason for this?

divyanshisaluja
Автор

The r+ does not always add the data at the beginning. its totally depends where the cursor is like if we use the read command and then write so in this case after reading data the cursor will be in the end and if then we use the write command then the new data will be added to the end of file: For example in this case: f = open("test.txt", "r+")
content = f.read()
f.write("john" )
f.close() : now in this case "john" will be added to the end of file. so remember the cursor is not always in the beginning in r+ mode its totally depends what you have done before that line of code. Happy coding😊

KanzaIltaf
Автор

36:42

def replace(old_string, new_string):
with open("practice2.txt", "r") as f:
data=f.read()

n_data = data.replace(old_string, new_string)
print(n_data)

with open("practice2.txt", "w") as f:
f.write(n_data)


replace("Java", "Python")

akhileshghatate
Автор

please create a series for AI, ML && Neutral Networks and cover all the topics.

codewithme
Автор

Thanks didi from bottom of my heart for this awasome python series.

Successthoughts
Автор

Ma'am if I run the "write command in VScode " it is not working. What should I do?
Pls help... when I run the write command the text in the txt file is not overwriting as you said.... the text remains the same. Pls 🙏🏽🙏🏽

GAMIDATA
Автор

mam, while replacing the word java to python, and after that the file should be overwritten, but when i was writing the code the file is not being overwritten but the new file is being created, which should not happen right?how should i come over this error.

namratamankar
Автор

For me this class is not running on VS code,
but working on Jupyter.
why is it so.

kritikapandit
Автор

Hi mam kitna aachha pdhati hai aap thank you so much

AkankshaRai-py
Автор

this series is most helpful for me ..thanks to shradhaa mam

anuragrahangdale
Автор

We love your classes,
Please make video lecture on pygame development 😢
Its our request

Vote for lectures on pygame
👇

DhritiYadav-iycv
Автор

Construct a program which accepts a sequence of words separated by whitespace as file input. Print the words composed of digits only.

S.Mishra
Автор

I didn't understand 38:00 where she writes "!= -1". Can someone explain.

harshiljana
Автор

It's really helping for students. The way you are providing knowledge in an easy and simple way.

SamMentors
Автор

Hey can anyone tell me why my data is not able to print in new file..Plzzzz

TUFFANGAMING
Автор

madam in practicle question 1 instead of using \n can we use multiline string quotes(tripple quotes ) as it is provinding the same output

ADITYAJHA-kl
Автор

it will be great for students if you start DSA with Python...

trishakarmakar