Try this:
from Bio import SeqIO
fout = open("output.fasta", "w")
handle = open("input.fasta", "r")
new_id=0
for seq_record in SeqIO.parse(handle, "fasta"):
seq_record.id = new_id
new_id =+ 1
seq_record.description = ""
print seq_record.id)
SeqIO.write(fout, lines_file[0]+".fasta","fasta")
fout.close()
It looks like you're currently trying to read the numbers from a file. When you take your file (in your case lines_file) and ask it for subscript 0 (i.e. [0]) you're really asking for the 0th character, not the first row. Python doesn't handle this (at least in a way I'm familiar with but then again I'm a C++ guy primarily).
The code above solves the problem by starting a variable at 0 and incrementing by 1 for each sequence record and then assigning it to the seq_record.id within the loop you already constructed. This doesn't solve the case if you wanted to extract out IDs from a file and transfer them in, which might be what you're really after.
If you're trying to do that, then you'll need to open the file (like you're currently doing) and instead of trying to access [0] in the file, you probably want to use the readline() method. You can try code like this:
seq_record.id=lines_file.readline()
Alternatively you can use:
seq_record.id=lines_file.readline().strip()
which will also remove the newline (I'm not sure if you want it to or not in this case). You would substitute one of these two lines for the line where you're currently saying:
seq_record.id = lines_file[0]
in your code.
I believe that should solve your issue, but I'm happy to help further if it doesn't quite get you there.