Minggu, 17 Maret 2019

How do I put a variable inside a String in Python?

I would like to put an int into a string. This is what I am doing at the moment:


end = smooth(data,window_len=40)
plot.plot(time[0:len(end)],end)
plot.savefig('hanning(40).pdf') #problem line

I have to run the program for several different numbers instead of the two 40's. So I'd like to do a loop but inserting the variable like this doesn't work:


plot.savefig('hanning',num,'.pdf')

How do I insert a variable into a Python string?



from How do I put a variable inside a String in Python?

How do I put a variable inside a String in Python? Rating: 4.5 Diposkan Oleh: Admin

0 komentar:

Posting Komentar

Popular Posts