<pre><code>from hdwallet import HDWallet
from hdwallet.symbols import BTC as SYMBOL


All_WIF = []

with open('/content/wif.txt') as f:
    data = f.readlines()
    for i in data:
        wif = i.strip('\n')
        All_WIF.append(wif.rstrip())

for each_wif in All_WIF:
    # Initialize Bitcoin testnet HDWallet
    hdwallet: HDWallet = HDWallet(symbol=SYMBOL)
    # Get Bitcoin HDWallet from wallet important format
    hdwallet.from_wif(wif=each_wif)
    print(&quot;Addrss: &quot; + hdwallet.p2pkh_address() + '    WIF: ' + hdwallet.wif())
</code></pre>

CC BY-SA 4.0
2023-06-25T06:35:14.123Z
bro thanks for saving my life
Dan Gonzalez
CC BY-SA 4.0
2023-06-25T01:41:55.473Z
2023-06-25T01:41:55.473Z
Romo
<p>I'm trying to convert a txt of WIF to Public Address but only convert the last line, if someone knows another way to do, i really appreciate</p>
<pre><code>from hdwallet import HDWallet
from hdwallet.symbols import BTC as SYMBOL
import sys
import os
import json
import requests
from requests import get


with open('/content/wif.txt') as f:
  for line in f:
    wif = line.rstrip()

# Initialize Bitcoin testnet HDWallet
hdwallet: HDWallet = HDWallet(symbol=SYMBOL)
# Get Bitcoin HDWallet from wallet important format
hdwallet.from_wif(wif=WALLET_IMPORTANT_FORMAT)

# Print all Bitcoin HDWallet information's
#print(json.dumps(hdwallet.dumps(), indent=4, ensure_ascii=False))


print(hdwallet.p2pkh_address()), (hdwallet.wif())
</code></pre>

<bip32-hd-wallets><private-key-import><wallet-import-format><importaddress><importmulti>
HD Wallet convert WIF from list to Public Address
Dan Gonzalez
# HD Wallet convert WIF from list to Public Address

(Asked by: username_0 on 2023-06-23)

I'm trying to convert a txt of WIF to Public Address but only convert the last line, if someone knows another way to do, i really appreciate

```
from hdwallet import HDWallet
from hdwallet.symbols import BTC as SYMBOL
import sys
import os
import json
import requests
from requests import get

with open('/content/wif.txt') as f:
  for line in f:
    wif = line.rstrip()

# Initialize Bitcoin testnet HDWallet
hdwallet: HDWallet = HDWallet(symbol=SYMBOL)
# Get Bitcoin HDWallet from wallet important format
hdwallet.from_wif(wif=WALLET_IMPORTANT_FORMAT)

# Print all Bitcoin HDWallet information's
#print(json.dumps(hdwallet.dumps(), indent=4, ensure_ascii=False))

print(hdwallet.p2pkh_address()), (hdwallet.wif())

```

**Tags:** bip32-hd-wallets, private-key-import, wallet-import-format, importaddress, importmulti


---

## 1 answers

### Answer by username_1 on 2023-06-25. Score: 0 | Accepted answer

```
from hdwallet import HDWallet
from hdwallet.symbols import BTC as SYMBOL

All_WIF = []

with open('/content/wif.txt') as f:
    data = f.readlines()
    for i in data:
        wif = i.strip('\n')
        All_WIF.append(wif.rstrip())

for each_wif in All_WIF:
    # Initialize Bitcoin testnet HDWallet
    hdwallet: HDWallet = HDWallet(symbol=SYMBOL)
    # Get Bitcoin HDWallet from wallet important format
    hdwallet.from_wif(wif=each_wif)
    print("Addrss: " + hdwallet.p2pkh_address() + '    WIF: ' + hdwallet.wif())

```

> **Comments:**
> **username_0**: bro thanks for saving my life  

---

