Python Forum
.Format Help - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: .Format Help (/thread-24826.html)



.Format Help - AgileAVS - Mar-06-2020

company_name=('ADBL','NABIL')
for page in company_name:
    url2= 'https://login.systemxlite.com/equity/{}'.format(page)
This is the beginning of the code and few mathematical operators and codes follow. What I want to know is how does it print the company name sequentially as the extraction and calculation goes on? For instance:
print(f'{company_name}','Overvalued:',NAV)
this gets me:
Output:
('ADBL', 'NABIL') Overvalued: 0.0007628829247572596 ('ADBL', 'NABIL') Overvalued: 0.0002816287922140694
But what I want is :
'ADBL' Overvalued: 0.0007628829247572596
'NABIL' Overvalued: 0.0002816287922140694


Thank you so much.


RE: .Format Help - michael1789 - Mar-06-2020

You are inserting the whole list each time. company_name is a list of two items, you want to print each item separately.
for each_name in company_name:
    print(f'{each_name}','Overvalued:',NAV)