How can python write to a file without line wrapping?

tgcode ="dafafadfaf"
result = "window.config = "%s";" % (tgcode)
print(result)
f.write(result, )


python  window.config ="dafafadfaf";
 
window.config ="dafafadfaf
";//
 " ,"  



//  
def modify_text_folder(tgcode):
CONFIG_PATT = "D:\\ANDROID\\test1\HBuilder-Integrate-AS\\app\src\\main\\assets\\apps\\H56356094\\www\\"
FIlENAME = "channelConfig.js"
fpath = CONFIG_PATT + FIlENAME
result = "window.config = "%s";" % (tgcode)
-sharp with open(fpath, "r+") as f:
-sharp     read_data = f.read()
-sharp     f.seek(0)
-sharp     f.truncate()  -sharp 
-sharp     result = "window.config = "%s";" % (tgcode)
-sharp     print(result)
-sharp     f.write(result)
-sharp     f.close()
print(result)
with codecs.open(fpath, "wb+", encoding="utf8")as f:
    f.truncate()
    f.write(result)
    f.close()

 
  result = "window.config = "%s";" % (tgcode) ; 




** 
excel  ~
 **


def writetxt(path, content, code):
    with codecs.open(path, 'wb+', encoding=code)as f:
        f.truncate()
        f.write(content)
        f.close()
    return path+' is ok!'

try to write with my method
test my no problem
here is the code I tested for you:

-sharp -*- coding: utf-8 -*-
import codecs

def writetxt(path, content, code):
        with codecs.open(path, 'wb+', encoding=code)as f:
                f.truncate()
                f.write(content)
                f.close()
        return path+' is ok!'
tgcode ="dafafadfaf"
result = "window.config = '%s';" % (tgcode)
print(result)

writetxt('./test',result,'utf8')
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31ac6-2b605.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31ac6-2b605.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?