Py学习  »  Python

如何使用自定义格式使用python组合2个文件

Sampath • 3 年前 • 1294 次点击  
with open('file_1.txt', 'r') as file :
    filedata_s = file.read()
with open('file_2.txt', 'r') as file :
    filedata_d = file.read()
print (filedata_s+filedata_d)

文件1包含名称\年龄\职业。。。etc文件2包含Bob\16\student。。。 期望的输出是

Name :- ‘Bob’
Age  :- '16'
Occ  :-'student'
              
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/131522
 
1294 次点击  
文章 [ 3 ]  |  最新文章 3 年前