python的replace函数用起来没效果怎么办?

file_path = '/red_alert_3y/python_work/file_txt_csv/python_learning_notebook.txt'

with open(file_path, encoding='UTF-8') as file:
    lines = file.readlines()
    for i in lines:
        i.replace('python', 'C++')
        print("\t" + i.rstrip().title())

然后输出是这样的

C:\Users\PZH71P\AppData\Local\Programs\Python\Python38\python.exe D:/red_alert_3y/python_work/python_file_py/file_python_learning_notebook.py
    In Python :The Zen Of Python, By Tim Peters
    In Python :Beautiful Is Better Than Ugly.
    In Python :Explicit Is Better Than Implicit.
    In Python :Simple Is Better Than Complex.
    In Python :Complex Is Better Than Complicated.
    In Python :Flat Is Better Than Nested.
    In Python :Sparse Is Better Than Dense.
    In Python :Readability Counts.
    In Python :Special Cases Aren'T Special Enough To Break The Rules.
    In Python :Although Practicality Beats Purity.
    In Python :Errors Should Never Pass Silently.
    In Python :Unless Licitly Silenced.
    In Python :In The Face Of Ambiguity, Refuse The Temptation To Guess.
    In Python :There Should Be One-- And Preferably Only One --Obvious Way To Do It.
    In Python :Although That Way May Not Be Obvious At First Unless You'Re Dutch.
    In Python :Now Is Better Than Never.
    In Python :Although Never Is Often Better Than *Right* Now.
    In Python :If The Implementation Is Hard To Explain, It'S A Bad Idea.
    In Python :If The Implementation Is Easy To Explain, It May Be A Good Idea.
    In Python :In Python :Namespaces Are One Honking Great Idea -- Let'S Do More Of Those!
Process finished with exit code 0

我的‘file_path’里面是我的改版的python之禅,前面加了In python: ,
但是用replace函数改Python为C++却改不了
求同志改改


file_path = '/red_alert_3y/python_work/file_txt_csv/python_learning_notebook.txt'
with open(file_path, encoding='UTF-8') as file:
    lines = file.readlines()
    for i in lines:
        i = i.replace('python', 'C++')   #替换好了以后一定要赋值
        print("\t" + i.rstrip().title())

区分大小写
i=i.replace('Python', 'C++')
且覆盖原值