Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Check the Ether balance of an account using Web3.py.
from web3 import Web3
w3 = Web3(Web3.HTTPProvider('http://127.0.0.1:8545'))
account = '0xYourAccountAddress'
balance = w3.eth.get_balance(account)
print('Balance:', w3.fromWei(balance, 'ether'), 'ETH')Web3.py is a Python library for interacting with the Ethereum blockchain. It allows developers to deploy, interact with, and query smart contracts, manage accounts, and handle blockchain transactions programmatically.
Origin & Creator
Web3.py was created by the Ethereum Foundation community in 2016 to provide a Pythonic interface to the Ethereum blockchain.
Industrial Note
Web3.py is preferred in Python-based projects, automated scripts, backend integrations, DeFi bots, and data analytics pipelines interacting with Ethereum.