#1
  1. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    155

    CLng() to Int()?


    I'm trying to convert VB6 code to Python, and the VB6 program is using CLng(). Here is one of the lines that I'm trying to translate:
    Code:
    lngKey = CLng(dblKey)
    I realized that lngKey is being turned into a double, and the new name is dblKey. In Python all I could think of was to use int(). But this obviously isn't going to do what I need it to do. What else is there I can use?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    London, England
    Posts
    1,585
    Rep Power
    1374
    You have it the wrong way round. dblKey is being turned into a long called lngKey. The int() function is what you want. If you ever need to do it the other way use float().

    Dave - The Developers' Coach
  4. #3
  5. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    155
    Ok, thanks for the help.

IMN logo majestic logo threadwatch logo seochat tools logo