'How would I remove "<function main at 0x7f2dba025d30>

How do I properly fix the main function? How would I remove "<function main at 0x7f2dba025d30>" from my output? My output works fine but I get

The following output:

function main at 0x7f2dba025d30>
AAPL 155.09
MSFT 287.15
AMD 109.33
import yfinance as yf

stocks = ['AAPL', 'MSFT', 'AMD']

def main():
    for stock in stocks:
        info = yf.Ticker(stock).info
        marketprice = info.get('regularMarketPrice')
        print(stock, marketprice)
print(main)

if __name__ == '__main__':
    main()


Solution 1:[1]

You are outputting <function main at 0x7f2dba025d30> because of the following line:

print(main)

This essentially tells Python to display the object main which is indeed, a function.

Removing the line will remove the output.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Antoine Delia