我试图在python中创建一个命令,通过写入〜/ .bashrc来创建新的别名,我的代码如下:
new_alias = raw_input("Choose alias name > ")
alias_command = raw_input("Write alias command > ")
with open("/test/text","r") as f2:
with open("text","w+") as f1:
f1.write(new_alias + alias_command)
f1.seek(0,0)
command = f1.read()
但是当我打开文本文件时,里面没有写任何内容,所以我的问题是我在这个文件中做错了什么?