uses a python removal of the character is a very troublesome thing, different environments can use a variety of methods, such as regular expressions, del grammar, now released is a relatively simple method is to meet the character to jump past, not its operation, showing a perfect delete the character the function of.


python text test code

 coding: UTF-8 def delblankline # -*- -*- (infile, outfile): infopen = open (infile,'r', encoding= "UTF-8") # open ontology file outfopen = open (outfile,'w', encoding= "UTF-8" #) lines = infopen.readlines (open file for line in lines:#) for DB in line:# by line reading word by reading if DB =='/': continue outfopen.write (DB) (infopen.close) # # file close file (outfopen.close) # to close the file delblankline ("jb51.txt", "04.txt") # function 

effect as shown below "//


is removed In the string, you can replace it with your own ok

This concludes the body part

This paper fixed link: | Script Home | +Copy Link

Article reprint please specify:Python deletes a character | Script Home

You may also be interested in these articles!