write in multiple files python

fn = open("path of input file.txt","r")
fnew = fn.read()
fs = fnew.split('\n')
for value in fs:
    f = [open("path of output file to write.txt" %i,'w') for i in range(len(list_of_files))]
    f.write(value)
    f.close()

3.5
10
Awgiedawgie 440220 points

                                    154,135
151,147
236.244

3.5 (10 Votes)
0
3.7
10
Awgiedawgie 440220 points

                                    fn = open("path of input file.txt","r")
for i, line in enumerate(fn):
    f = open("/home/vidula/Desktop/project/ori_tri/input_%i.data" %i,'w')
    f.write(line)
    f.close()

3.7 (10 Votes)
0
4
10
Rubixphys12 15320 points

                                    "['128,129', '116,118', '108,104', '137,141', '157,144', '134,148', '138,114', '131,138', '248,207', '208,247', '246,248', '101,106', '131,115', '119,120', '131,126', '138,137', '132,129']"
"['154,135', '151,147', '236,244', '243,238', '127,127', '125,126', '122,124', '123,126', '127,129', '122,121', '147,134', '126,132', '128,137', '233,222', '222,236', '125,126']"

4 (10 Votes)
0
4.67
3
A-312 69370 points

                                    128,129
116,118
108,104

4.67 (3 Votes)
0
Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source