Open file and write | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Open file and write

I am trying to open a file with RGB colors I want to make it as a list of 3 and save it.. file = input('Enter the name of color file: ') infile = open(file+'.txt','r') outfile = open('c1.txt','w') for line in infile : line = infile.readline() line = line.split(' ',3) outfile.write(line) infile.close() outfile.close() When I open the text file it is empty

17th Nov 2018, 9:25 AM
Student
Student  - avatar
2 Answers
+ 1
use c#, it has StreamReader and StreamWriter and it's easy to understand
17th Nov 2018, 12:29 PM
_yaroslavv [online_everyday]
_yaroslavv [online_everyday] - avatar
0
After that I want to use for loop to read the color from the file and drow a lines with the read color in a window
17th Nov 2018, 9:27 AM
Student
Student  - avatar