标签: python file variables text partial
我有以下变量12345678901234567890 我想从变量78901
12345678901234567890
78901
123456(78901)234567890
我怎么能这样做?
由于
答案 0 :(得分:5)
string = '12345678901234567890' name = string[6:11] with open(name, 'w') as f: f.write("hello world")