-2

I have the following variable 12345678901234567890 and I want to create a text file named with the part 78901 from the middle of the variable 123456(78901)234567890

How I can do that ?

Thanks

abualameer94
  • 91
  • 3
  • 13

1 Answers1

5
string = '12345678901234567890'
name = string[6:11]
with open(name, 'w') as f:
    f.write("hello world")
John
  • 13,197
  • 7
  • 51
  • 101