Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.04; 'base.': 0.05; 'arguments': 0.07; 'filename': 0.07; 'function,': 0.07; 'only,': 0.07; 'plenty': 0.07; 'behave': 0.09; 'encode': 0.09; 'given,': 0.09; 'integer,': 0.09; 'literal': 0.09; 'prefixed': 0.09; 'subject:method': 0.09; 'surrounded': 0.09; 'zero.': 0.09; 'stored': 0.10; '(but': 0.15; '-16': 0.16; '16.': 0.16; '4-digit': 0.16; 'advice,': 0.16; 'literal,': 0.16; 'literals': 0.16; 'optionally': 0.16; 'radix': 0.16; 'range,': 0.16; 'skip:1 40': 0.16; 'truncates': 0.16; 'whitespace.': 0.16; 'string': 0.17; 'wrote:': 0.17; 'integer': 0.17; 'string,': 0.17; 'subject:page': 0.17; 'unicode': 0.17; '(or': 0.18; 'code.': 0.20; 'error.': 0.21; 'displayed': 0.22; 'int,': 0.22; 'interpret': 0.22; 'produces': 0.22; 'for?': 0.23; 'long,': 0.24; 'tried': 0.25; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'values': 0.26; 'am,': 0.27; 'plain': 0.27; 'instead.': 0.27; "doesn't": 0.28; 'actual': 0.28; 'represent': 0.28; 'base,': 0.29; 'convert': 0.29; 'words': 0.29; 'function': 0.30; 'point': 0.31; 'towards': 0.32; 'url:python': 0.32; 'quickly': 0.32; 'page.': 0.33; "aren't": 0.33; 'correctly.': 0.33; 'point,': 0.33; 'subject: .': 0.33; 'to:addr:python-list': 0.33; '(with': 0.33; 'built-in': 0.35; 'described': 0.35; 'especially': 0.35; 'table': 0.35; 'there': 0.35; 'but': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'thank': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'url:docs': 0.38; 'page': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'space': 0.39; 'received:192.168': 0.40; 'think': 0.40; 'link': 0.60; 'visit': 0.64; '10.': 0.64; 'charset:windows-1252': 0.65; 'of:': 0.65; 'pin': 0.65; 'received:74.208': 0.71; 'float,': 0.84; 'subject:Using': 0.84; 'url:functions': 0.84 Date: Tue, 22 Jan 2013 11:11:35 -0500 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Using filepath method to identify an .html page References: <50fe787e$0$30003$c3e8da3$5496439d@news.astraweb.com> <50fe8e69$0$30003$c3e8da3$5496439d@news.astraweb.com> <0459659d-4ec2-4c7d-bee3-b4e363c916dd@googlegroups.com> <9d89d978-e570-4b2c-a18e-58d86c35dd4c@googlegroups.com> In-Reply-To: <9d89d978-e570-4b2c-a18e-58d86c35dd4c@googlegroups.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:CoCidLsOdy840EapQlb/6jor3GdfC7k2/eXfJJqgL1e HmPd1zBtIYf+Hk5bTtl9F/y6G0GtP+EQPic8GanAYWFIzZeM4j /GAilAirkd1ABm/rAGkYoSX9gfTFTrNmMyzTfzemVaN80+Ut3c aEmC3awkdEbrXOgTkpkJ43vhvuIldvHGC+nIAU9cp0k8dSYRGT rHaWPdD0bX6Ms8rigSHV3blMObDrqFAcR9adjntoo3BNg1nXtX IdRB7X6YC1QneAe6qpwVtuF7N43B/Xziu4ptcWb6WsubswJuS5 GLvnjurIQsRBI67QnzAYHrkqmlQm0y6dukTKoHIo/sBMoGEOA= = X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 56 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358871116 news.xs4all.nl 6854 [2001:888:2000:d::a6]:60162 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37298 On 01/22/2013 10:46 AM, Ferrous Cranus wrote: > Thank you but the number needs to be a 4-digit integer only, if its to be stored in the database table correctly. > > pin = int( htmlpage.encode("hex"), 16 ) > > I just tried whayt you gace me > > This produces a number of: 140530319499494727...677522822126923116L > > Visit http://superhost.gr to see that displayed error. I think it > > Why did you use "hex" for? to encode the string to hexarithmetic? what for? > There are plenty of people (but not me) giving you database advice, but you don't want it. Apparently you do have web access, so why aren't you looking up the functions that don't behave the way you think they should? This page has the built-in functions: http://docs.python.org/2/library/functions.html To get quickly to a particular function, follow the link from the function name at the top of that page. """""" int(x=0) int(x, base=10) Convert a number or string x to an integer, or return 0 if no arguments are given. If x is a number, it can be a plain integer, a long integer, or a floating point number. If x is floating point, the conversion truncates towards zero. If the argument is outside the integer range, the function returns a long object instead. If x is not a number or if base is given, then x must be a string or Unicode object representing an integer literal in radix base. Optionally, the literal can be preceded by + or - (with no space in between) and surrounded by whitespace. A base-n literal consists of the digits 0 to n-1, with a to z (or A to Z) having values 10 to 35. The default base is 10. The allowed values are 0 and 2-36. Base-2, -8, and -16 literals can be optionally prefixed with 0b/0B, 0o/0O/0, or 0x/0X, as with integer literals in code. Base 0 means to interpret the string exactly as an integer literal, so that the actual base is 2, 8, 10, or 16. The integer type is described in Numeric Types — int, float, long, complex. """""""" Are there words in there which are unclear? A filename is a string, but it doesn't represent an integer literal in any base, and especially not in base 10. -- DaveA