标签:new find input index pytho inpu open file read
```python
file_Name = input("请输入要备份的文件名")
file_1 = open(file_Name,"r")
index = file_Name.rfind(‘.‘)
if index > 0:
new_name = file_Name[:index]+"备份"+file_Name[index:]
else:
new_name = file_Name+"备份"
file_2 = open(new_name,"w")
count = file_1.read()
file_2.write(count)
file_1.close()
file_2.close()
```
标签:new find input index pytho inpu open file read
原文地址:https://www.cnblogs.com/liufengji/p/13869553.html