On 8/13/2014 12:11 PM, taifuls...@gmail.com wrote:

I am new in Python programming.
> Currently reading the book " Learn Python the Heard Way".

The title is '... Hard Way'. This is literally true. The author 'warns' beginners to not learn Python 3, which is easier to learn than Python 2, and works better in many ways.

Even worse, he warns people not to use Idle (or any other IDE) and use a plain text editor like Notepad++ and a terminal to edit and run programs. This is definitely the Hard Way compared to edit and run with Idle. I know from experience, because I started the way he recommends (editor and command prompt) and put off learning to use Idle. What I fool I was.

> However i need a python script which will take
an image file (any standard format) from my windows pc as input.

Python will read any file as input: bytes are bytes. Open non-text files in binary mode. For example,

pic = open('image.jpg', 'rb')  # I believe this is the same in 2.x.

However, this is not useful unless you know the file layout and enjoy parsing it at the byte level. Better to use a package that does that for you. For doing anything with images, you might use pillow, a friendly updated fork of PIL (Python Imaging Library), which works on 2.6-7 and 3.2-4. I just did
C:\Programs\Python34>pip install pillow
(I have been meaning to do this anyway) and a few seconds later it is installed and 'import PIL' works.

For the docs, I had to go back to
https://pypi.python.org/pypi/Pillow/2.5.2
to find the reference to
http://pillow.readthedocs.org/en/latest/

In Idle I added 'pillow' to the help menu, linked to the url above, using the options dialog General tab, Additional Help Sources box.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to