社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Python

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

Sampath • 3 年前 • 1293 次点击  
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
 
1293 次点击  
文章 [ 3 ]  |  最新文章 3 年前