Removing a specific character from a text file

前端 未结 1 647
野的像风
野的像风 2021-01-29 13:30

I\'m new to Python and coding generally, and I was doing a tiny project and I\'m facing a problem:

44, 1, 6
23, 2, 7
49, 2, 3
53, 2, 1
68, 1, 6
71, 2, 7
<         


        
相关标签:
1条回答
  • 2021-01-29 14:21

    You can replace the character

    with open(r'c:\input.txt', 'r') as infile,
         open(r'c:\output.txt', 'w') as outfile:
        data = infile.read()
        data = data.replace(",", "")
        outfile.write(data)
    

    Reference

    0 讨论(0)
提交回复
热议问题