TypeError: coercing to Unicode: need string or buffer, file found in python(writing data from existing files into single file) -


i supposed write data 3 existing files single file in python. faced error "typeerror: coercing unicode: need string or buffer", file found. 3 existing files e, g , m , made file named results writing data 3 mentioned existing files. appreciate help

filenames= [e,g,m] open(results, "w") outfile: file in filenames: open(file) infile: line in infile: outfile.write(line)

your filename should string. filename e, m, g should "e", "m", "g", result should "result". refer code below:

#!/usr/bin/python # -*- coding: utf-8 -*-  filenames= ["e","g","m"]  open("results", "w") outfile:     file in filenames:         open(file) infile:             line in infile:                 outfile.write(line) 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -