🔒 Closed [3] python basics: reading out a line from file

Status
Not open for further replies.

Vladimir420

Established
Ito madali lang to pag alam nyo na mag open ng file. Skip ko na yung ibang explanation kasi nasa attribute na yung meaning mismo.

Code:
f = open('file.txt')
f.write('Text as string')

#para ma read yung Argument #1  sa f.write, ito gagamitin natin.

f.readline() #output nito ay string.
#or
line_text = f.readline()
print(line_text)
#easy diba.
Maya na natin i-implement dun sa guessing game natin. Pero dahil madali lang sya, explore nyo na. :D
Next topic: implementing the reading of a text ro the game
 
Status
Not open for further replies.

About this Thread

  • 0
    Replies
  • 722
    Views
  • 1
    Participants
Last reply from:
Vladimir420

Trending Topics

Online now

Members online
1,121
Guests online
12,078
Total visitors
13,199

Forum statistics

Threads
2,360,894
Posts
29,412,113
Members
1,063,403
Latest member
swishxxxq
Back
Top