Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.Format Help
#1
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.
Reply
#2
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)
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020