0

For starters I'm going to make a program which analyses my poker hand histories which are stored automatically as text files.

So which library do I need to snoop around in if I'm looking to analyse .txt files? I mean I can find some functions but I want to become more independent instead of googling a solution each time and actually learning things by myself...tell me if this is a stupid idea.

Thanks in advance.

Charles
  • 50,943
  • 13
  • 104
  • 142
Behzad
  • 123
  • 1
  • 1
  • 11
  • How do these text files look like? Plain text files can be read using Python's built-in `open()` method. – eumiro Jul 16 '12 at 12:15

1 Answers1

2

open() if its very simple, csv if its a bit more complicated and pandas for everything else.

Burhan Khalid
  • 169,990
  • 18
  • 245
  • 284
  • yes it's plain text. So if I use open() then f.read() I can save that txt file as a string? – Behzad Jul 16 '12 at 12:20
  • @Behzad Basically, yes. You'll want to consider using the [with](http://stackoverflow.com/a/1369553/264775) keyword, like `with open("file.txt", "r") as someName`, instead of just `open()` - it closes the file properly if things go wrong. – thegrinner Jul 16 '12 at 12:25