Hi, how are you?
Text file
For example, it is called as followsHmmm
data = open('text.txt')
aa=data.read()
bb=data.readline()
If you use these two,
In the first aa, print(aa), the contents of the text file appear
The second bb seems to be read without error, but if you print (bb), It looks like there's nothing.
[]
If I load a text file from Python and read it once, can't I read it with another read line?
If I want to use two according to the situation, should I reopen the text file every time?
python
The seek method allows you to adjust the position of the file pointer. It would be helpful if you look for file pointers and seek methods.
© 2024 OneMinuteCode. All rights reserved.