[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Substuting ";" with "," in a TWS trade file



PureBytes Links

Trading Reference Links

Herman van den Bergen wrote:

> would anyone have code or know how to substitute semi-colons in a file 
> with commas?
>  
> The TWS outputs trade records in semi-colon separated text file, like so:
>  
> RIMM;SLD;50;72.56;13:32:59;20050407;ISLAND;U84507;;;534;
> RIMM;BOT;100;73.04;13:37:49;20050407;ISLAND;U84507;;;534;
> RIMM;SLD;50;73.44;13:41:56;20050407;ISLAND;U84507;;;534;
> RIMM;SLD;50;73.44;13:41:56;20050407;ISLAND;U84507;;;534;
>  
> I want to read the files with afl which would be so much easier if the 
> semi-colons were commas.

Here's a simple Python <http://www.python.org> script that does it.

---
s = ''
for line in file('inputFilenameGoesHere'):
  newLine = line.replace(';',',')
  s = s + newLine
 
file('outputFilenameGoesHere','w').write(s)
---

Bill


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/