2021年1月19日星期二

How do I combine two text files line by line with Python?

I have two text files. Both files contain coordinates that I would like to be combined into one file that I could plug into a line of best fit calculator. However, I can't seem to figure out how to combine them. The answer is probably simple, but I am new to python.

File 1

123  154  123  312  241  151  

File 2

7832910  4839822  5732910  4832910  1875821  3632910  

How do I combine them into 1 text file with commas separating them. For example:

File 3

123, 7832910  154, 4839822  123, 5732910  312, 4832910  241, 1875821  151, 3632910  

This is my first time on Stack Exchange so thank you!

https://stackoverflow.com/questions/65802511/how-do-i-combine-two-text-files-line-by-line-with-python January 20, 2021 at 11:05AM

没有评论:

发表评论