Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > Internet Gambling > Software
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-17-2007, 11:13 PM
duh duh is offline
Senior Member
 
Join Date: Aug 2005
Posts: 1,379
Default Python help needed! Stars screwed me..

A year ago I wrote a python script to merge/update my Pokerstars notes on my two computers. This script takes 2 (or more) notes.txt files as input and outputs a single file that contains both sets of notes with no duplicates. Anyway...

Recently Stars changed the format of the Notes.txt files. I am in the process of updating my script, but it seems that Stars is using some kind of different encoding for the text.
I was thinking unicode obv, but I can't get it to print out right.

When I open the notes.txt in notepad, it looks fine. But when the file is read and echoed to the terminal, there is a non alphanumeric character between each legit character. Here is a screenshot:





What am I doing wrong when reading this file?




edit: here is how i'm reading:

inp = open(inputfile, "r")
noteList = inp.read().split("\n")
inp.close()
Reply With Quote
  #2  
Old 11-18-2007, 01:51 PM
duh duh is offline
Senior Member
 
Join Date: Aug 2005
Posts: 1,379
Default Re: Python help needed! Stars screwed me..

bump
Reply With Quote
  #3  
Old 11-18-2007, 03:38 PM
notreallymyname notreallymyname is offline
Senior Member
 
Join Date: Dec 2006
Location: NL100
Posts: 123
Default Re: Python help needed! Stars screwed me..

Use codecs.open (import codecs) - codecs.open('Notes.txt', 'r', 'utf_16'). You'll have to change some of your code to use unicode where it currently doesn't though (e.g. that split, although list(inp) would work fine there)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:45 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.