User Profile

Collapse

Profile Sidebar

Collapse
w41ter
w41ter
Last Activity: Mar 19 '10, 11:19 PM
Joined: Mar 14 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • I think perl is less fussy about automatic type conversions, isn't it? Haven't done much with perl, but I got that impression, anyway.

    Heh, I got atoi from an O'Reilly Python book I bought in 1999 and just got around to reading last week :)

    Thanks to bvdet for the strptime examples, looks useful....
    See more | Go to post

    Leave a comment:


  • Hrrmph. This morning the magic is gone and I get a string in d, just like you did. Last night I was running the code in a live python session and I obviously did something I can't remember now :(

    Today I got the job done with this code instead:
    Code:
    for lines in f:
            d,t,o,h,l,c,v = lines.split(',')
            yr,mo,day = d.split('.')
            if datetime.date(string.atoi(yr),string.atoi(mo),string.atoi(day)).weekday()
    ...
    See more | Go to post
    Last edited by bvdet; Mar 15 '10, 01:20 AM. Reason: Add code tags

    Leave a comment:


  • w41ter
    started a topic Character string wind up as a datetime.date object?

    Character string wind up as a datetime.date object?

    I'm writing a very simple python program to read in an ascii csv file with multiple records formatted like this:

    "2010.3.13, 0.0.0, 10.1, 12.2, 9.9, 10.1, 2500" # i.e. a list of daily stock prices with date,time,open, high,low,close, volume fields

    I use this python code to read each line from the ascii file named f:

    for line in f: d,t,o,h,l,c,v = line.split(',') # where d stands for date, etc
    ...
    See more | Go to post
No activity results to display
Show More
Working...