C++中====================================
# include<iostream>
# include<fstream>
# include<string>
using namespace std;
//写
int main()
{
int a;
a = 10;
ofstream outfile("C:\\Users\\10544\\Desktop\\test.txt", ios::trunc);
//ios::app追加写, ios::trunc覆盖写
outfile << a;
outfile.close();
return 0;
}
python中======================================
if __name__ == '__main__':
with open('C:\\Users\\10544\\Desktop\\test.txt',"r") as f:#以只读的方式打开文件夹
data=f.read()
print(data)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)