Jump to content

[DUVIDA] Como eu verifico se um valor já existe em um aquivo txt pelo io.open


Luffy
 Share

Recommended Posts

36 minutos atrás, Tierri Lopes disse:

if 'blabla' in open('example.txt').read():
    print("true")

ou


open('file', 'r').read().find('')

 

https://stackoverflow.com/questions/4940032/how-to-search-for-a-string-in-text-files

Muito obrigado, Tierri!

E se eu quisesse obter um valor que ta dentro do aquivo txt, o que eu teria de fazer?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...