Gustavo
Gustavo

Reputation: 33

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))

Upvotes: 2

Views: 368

Answers (1)

Doyousketch2
Doyousketch2

Reputation: 2147

Think it's more like this:

import pyperclip

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

Upvotes: 2

Related Questions