How do I print unspent transaction outputs of an address using pybitcointools I am a beginner looking to write a simple program that takes an input (address) and prints the unspent amount in it.

I copied some code from chapter 4 of Mastering Bitcoin to generate a random keypair, and the last lines Andreas had in the code I copied were:

&gt;     # Generate bitcoin address from public key
&gt;       print "Bitcoin Address (b58check) is:", bitcoin.pubkey_to_address(public_key)
&gt;     
&gt;     # Generate compressed bitcoin address from compressed public key
&gt;       print "Compressed Bitcoin Address (b58check) is:", \
&gt;           bitcoin.pubkey_to_address(hex_compressed_public_key)


I added the following bit at the end that prints the UTXO. It is currently printing "[ ]" because there are no UTXOs because I'm generating a new address, but it at least works when I do this and prints something.

&gt;     #Print the UTXO for the given address     
&gt;     print bitcoin.unspent(bitcoin.pubkey_to_address(public_key))


However, when I type an address instead of the "(bitcoin.pubkey_to_address(public_key))", like so:

&gt;     print bitcoin.unspent(16jn6k2FJqwrNLDpbZmmmpf4TCW7uM6LED)


It gives me an error ("SyntaxError: invalid syntax) and points to the "D" at the end of the address. I really want to use this specific bit of code to enable me to enter an address and have the UTXOs returned. (Please note, I just found that address on blockchain.info by clicking addresses until one with unspent coins came up! Also I am a complete novice so please go easy on me!)

Thanks in advance
&gt;     print bitcoin.unspent('16jn6k2FJqwrNLDpbZmmmpf4TCW7uM6LED')


Sovled the issue.