在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
c语言: #include <stdio.h> #define MAX_LINE 100 FILE *fp; char line[] = ""; void main() { fp = fopen("test.txt", "r"); while (fgets (line, MAX_LINE, fp) != NULL) { printf("%s", line); } fclose(fp); } php: <?php $fp = fopen('test.txt', 'r'); while($line = fgets($fp)) echo $line; fclose($fp); ?> ruby: file = File.open("test.txt", "r") print file.each_line { |line| puts line } file.close python: file = open("test.txt") for line in file: print(line, end='') file.close() |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论