#!/usr/bin/env python# -*- coding:utf-8 -*-with open (‘1.txt‘) as f1: f1.line = f1.readlines() print (f1.line) with open(‘2.txt‘) as f2: f2.line = f2.readlines() print (f2.line) #写在一块 中间用,分开,注意最后:结尾, 类似循环语句的结尾with open (‘1.txt‘) as f1,open(‘2.txt‘) as f2: f1.line = f1.readlines() f2.line = f2.readlines() print (f1.line) print (f2.line)
时间: 2024-10-11 23:10:59