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.

jb51.txt

http://www.jb51.net/article/1.htm

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 "//files.jb51.net/file_images/article/201803/20180319221615.png

"

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


This concludes the body part

This paper fixed link:http://www.script-home.com/python-deletes-a-character.html | Script Home | +Copy Link

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

You may also be interested in these articles!