Re: int vs. float

2017-02-11 Thread Marko Rauhamaa
boB Stepp : > According to the OP's professor's challenge, the OP needs to recognize > an input of "4.0" as a float and "4" as an integer, and to respond > with an error message in the float case, or "decimal number" case as > the OP phrased it. Apparently only positive integers are acceptable >

Re: int vs. float

2017-02-11 Thread Amit Yaron
On 11/02/17 09:47, boB Stepp wrote: On Sat, Feb 11, 2017 at 1:00 AM, Amit Yaron wrote: On 10/02/17 21:15, Peter Pearson wrote: On Fri, 10 Feb 2017 13:59:45 +0200, Amit Yaron wrote: On 10/02/17 04:33, adam14711...@gmail.com wrote: My computer programming professor challenged me to figure

DJANGO image processing

2017-02-11 Thread Xristos Xristoou
I want to create a django app with the base64 help where the users can upload images(specific ".tiff" ext) using DJANGO forms without model and without that images store in my server. and i will the users can be get back new processing image. i have success with encode/decode image with base64 a

Re: int vs. float

2017-02-11 Thread Erik
[Dan, this isn't "aimed" at you personally, it's just a follow-up on the general point I am (and I think you are also) making] On 11/02/17 02:17, Dan Sommers wrote: At least it works both ways: Python 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170118] on linux Type "help", "copyright"

Re: int vs. float

2017-02-11 Thread Steve D'Aprano
On Sat, 11 Feb 2017 07:24 pm, Marko Rauhamaa wrote: > boB Stepp : > >> According to the OP's professor's challenge, the OP needs to recognize >> an input of "4.0" as a float and "4" as an integer, and to respond >> with an error message in the float case, or "decimal number" case as >> the OP phr

Re: int vs. float

2017-02-11 Thread Chris Angelico
On Sun, Feb 12, 2017 at 2:27 PM, Steve D'Aprano wrote: >> >> For example: >> >>>>> ast.literal_eval("( 1.0, 3 )").__class__.__name__ >>'tuple' > > > In what way does returning a tuple match the requirement "return an int or a > float or generate an error message"? Easy. You just use a ver

Re: int vs. float

2017-02-11 Thread Steve D'Aprano
On Sat, 11 Feb 2017 06:00 pm, Amit Yaron wrote: > Another option: > Use 'float' instead of 'int'. and check using the method 'is_integer' > of floating point numbers: > > >>> 3.5.is_integer() > False > >>> 4.0.is_integer() > True A bad option... py> float('12345678901234567') 1.234567890123

Re: os.path.isfile

2017-02-11 Thread Steve D'Aprano
On Sat, 11 Feb 2017 06:50 am, Vincent Vande Vyvre wrote: > Le 10/02/17 à 19:11, epro...@gmail.com a écrit : >> Hello NG >> >> Python 3.5.2 >> >> Windows 10 >> >> os.path.isfile() no recognise file with double dot? >> >> eg. match.cpython-35.pyc >> >> Please somebody know something about that? >> >

Re: os.path.isfile

2017-02-11 Thread Steve D'Aprano
On Sat, 11 Feb 2017 05:11 am, epro...@gmail.com wrote: > Hello NG > > Python 3.5.2 > > Windows 10 > > os.path.isfile() no recognise file with double dot? > > eg. match.cpython-35.pyc I doubt that very much. I expect you are probably writing something like this: path = 'My Documents\testin

Re: Rename file without overwriting existing files

2017-02-11 Thread Steve D'Aprano
On Fri, 10 Feb 2017 12:07 am, eryk sun wrote: > On Thu, Feb 9, 2017 at 11:46 AM, Steve D'Aprano > wrote: >> >> So to summarise, os.rename(source, destination): >> >> - is atomic on POSIX systems, if source and destination are both on the >> same file system; >> - may not be atomic on Windows? >

Re: os.path.isfile

2017-02-11 Thread eryk sun
On Sun, Feb 12, 2017 at 3:52 AM, Steve D'Aprano wrote: > In Python, you should always use forward slashes for paths, even on Windows. There are cases where slash doesn't work (e.g. some command lines; \\?\ prefixed paths; registry subkey paths), so it's simpler to follow a rule to always convert

Re: os.path.isfile

2017-02-11 Thread Chris Angelico
On Sun, Feb 12, 2017 at 3:20 PM, eryk sun wrote: > On Sun, Feb 12, 2017 at 3:52 AM, Steve D'Aprano > wrote: >> In Python, you should always use forward slashes for paths, even on Windows. > > There are cases where slash doesn't work (e.g. some command lines; > \\?\ prefixed paths; registry subkey

Re: int vs. float

2017-02-11 Thread Steve D'Aprano
On Sun, 12 Feb 2017 02:34 pm, Chris Angelico wrote: > On Sun, Feb 12, 2017 at 2:27 PM, Steve D'Aprano > wrote: >>> >>> For example: >>> >>>>>> ast.literal_eval("( 1.0, 3 )").__class__.__name__ >>>'tuple' >> >> >> In what way does returning a tuple match the requirement "return an int >> o

Re: os.path.isfile

2017-02-11 Thread Steve D'Aprano
On Sun, 12 Feb 2017 03:20 pm, eryk sun wrote: > On Sun, Feb 12, 2017 at 3:52 AM, Steve D'Aprano > wrote: >> In Python, you should always use forward slashes for paths, even on >> Windows. > > There are cases where slash doesn't work (e.g. some command lines; > \\?\ prefixed paths; registry subke