0
Follow
0
View

Ask a function return value display problem

dzxyshuo 注册会员
2023-02-25 14:09
< div class = "md_content_show e397 data - v - 3967" = "" >

f.f lush() < br / > f.s eek(0) < br / > the first you need to submit, second, You need to move the pointer to the beginning of the file

kcsj999 注册会员
2023-02-25 14:09

First, you define the function, you don't call it

Second, your file open mode is set to r+, after writing the contents, the pointer is at the end of the file, you need f.sek(0), to put the pointer back

daiyuanrui 注册会员
2023-02-25 14:09

r+ mode can be both read and write, I have written content on the file, but run the program print does not come out

xudong9 注册会员
2023-02-25 14:09

First, the problem with the first picture. You don't run the function

NIUNIU030242 注册会员
2023-02-25 14:09

After writing, the pointer to the file stays at the end by default. To read the contents, you can adjust the pointer to the start position