How to reformat the output items in the body of an email in Python?

At the moment I get the output :
coin1 coin2 coin3 .....
volume1 volume2 volume3 ....
close1 close2 close3 ......

How can I make in the body of the email output that format?
coin1 close1 volume1
coin2 volume2 close2
coin3 volume3 volume3

sendcoins = coinscoins
#Breaking sheets on the values of the join function
 sendcoins_str = ' '.join(sendcoins) 
 volumecoins_todaytoaverage_str = ' '.join(volumecoins_todaytoaverage)
 close_str = ' '.join(close_p)

 # Settings
 mail_sender = 'xx'
 mail_receiver = 'xxx
 username = 'xxx'
 password = 'xxx'
 server = smtplib.SMTP('smtp.mail.EN:587')

 # Form the body of the email
 subject = u Coins or tokens with a large amount of ' # + mail_sender
#Deduce the values in the body of the message
 body = 'Coins:' + sendcoins_str + '\n' + 'Volume_ratio:' + volumecoins_todaytoaverage_str + '\n' + 'close:' + close_p_str 
 msg = MIMEText(body, 'plain', 'utf-8')
 msg['Subject'] = Header(subject, 'utf-8')

 # Send the email
 server.login(username, password)
 server.sendmail(mail_sender, mail_receiver, msg.as_string())
March 12th 20 at 08:39
1 answer
March 12th 20 at 08:41
For example, here so.
coins = ['coin1', 'coin2', 'coin3']
values = ['val1', 'val2', 'val3']
closes = ['clo1', 'clo2', 'clo3']

result_strings = zip(coins, values, closes)
further, according to the desire.

As an example:
for pair in result_strings:
Thank you, and then I put them in the body of the email in the format of str?
How to shove this loop into the body of the email? - royal commented on March 12th 20 at 08:44
for example, here so
final_string = '\n'.join([' '.join(line) for line in result_strings])
(here the construction of the two operations - first the elements are United through the space for each tuple of result_strings [' '.join(line) for line in result_strings], And then the resulting list again are United through the indicator of a new row).

I am sure that can be solved in other ways, you should think about it) Because the efficiency is shown to approach linearly depends on the number [coin value close] in resultstrings - berenice98 commented on March 12th 20 at 08:47
Figured out another method, but for this too, thanks. Coins Will not be very much from 2 to 30. - royal commented on March 12th 20 at 08:50
@berenice98, still your method is better and more beautiful. Put 1000 likes. Sorry never entered the paid questions on Toster,so it was a good idea for monetization. - royal commented on March 12th 20 at 08:53

Find more questions by tags Python