[Tutor] Importing data from a file.

Shall, Sydney sydney.shall at kcl.ac.uk
Thu Mar 21 14:59:06 CET 2013


On 21/03/2013 13:54, Amit Saha wrote:
> On Thu, Mar 21, 2013 at 11:43 PM, Shall, Sydney <sydney.shall at kcl.ac.uk> wrote:
>> I have an elementary question provoked by another post today.
>>
>> 1. Is it the case that ALL imported data from a file is a string?
>> 2. Does this therefor imply that said data has to be processed appropriately
>> to generate the data in the form required by the program?
> To the best of my knowledge, yes to both of your queries. Once you
> have the element you want to process, you can make use of the type
> converting functions (int(), float().. ) and use them appropriately.
>
>> 3. Are there defined procedures for doing the required processing?
> If you meant conversion functions, int() and float() are examples of
> those. You of course  (most of the times) have to make use of string
> manipulation functions (strip(), rstrip(), etc) to extract the exact
> data item you might be looking for. So, they would be the building
> blocks for your processing functions.
>
> I hope that makes some things clear.
>
> -Amit.
>
Yes, Thanks. This is now quite clear.
Sydney

-- 
Professor Sydney Shall,
Department of Haematological Medicine,
King's College London,
Medical School,
123 Coldharbour Lane,
LONDON SE5 9NU,
Tel & Fax: +44 (0)207 848 5902,
E-Mail: sydney.shall,
[correspondents outside the College should add; @kcl.ac.uk]
www.kcl.ac.uk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130321/178b9191/attachment-0001.html>


More information about the Tutor mailing list