Search code examples
pythonpyperclip

how to paste in a txt in python


I'm trying to paste in a txt block but I always get an error no matter how hard I try

the copy part is already resolved but pasting in a txt not yet

import pyperclip

with open('conta.txt', 'w+') as f:
    conteudo = f.write()
    pyperclip.paste(str(conteudo))

Solution

  • Think it's more like this:

    import pyperclip
    
    with open('conta.txt', 'w+') as f:
        f.write( pyperclip.paste() )