Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Importing data from the web

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125178] Re: Importing data from the web
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sun, 26 Feb 2012 04:20:58 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201202250655.BAA01311@smc.vnet.net>

data4 = {{"050318", "00111529"}, {"050401", "00113120"}};

Do[ID = data4[[i, 2]];
 s = Import["http://www.swift.ac.uk/xrt_curves/"; <> ID, "Text"];
 Print[s], {i, 1, Length[data4]}]

However, you might find Table more useful than Do

s1 = Table[ID = data4[[i, 2]];
   Import["http://www.swift.ac.uk/xrt_curves/"; <> ID, "Text"],
   {i, 1, Length[data4]}];

All of the data is then stored in s1

Alternatively, without Table or Do

s2 = Import["http://www.swift.ac.uk/xrt_curves/"; <> Last[#], "Text"] & /@
   data4;

s1 == s2

True

Bob Hanlon


On Sat, Feb 25, 2012 at 1:55 AM, maria giovanna dainotti
<mariagiovannadainotti at yahoo.it> wrote:
>
> Dear Math Group,
>
> I have a problem importing the data from a web page.
>
> data4 = {{"050318", "00111529"}, {"050401", "00113120"}}
> Do[
>  ID = data4[[i, 2]];
>  s = Import["http://www.swift.ac.uk/xrt_curves/<>ID<>", "Text"];
>  Print[s],
>  {i, 1, Length[data4]}]
>
> The error message is
> $Failed
>
> I am really grateful if you could help me
>
> Best regards,
> Maria



  • Prev by Date: Probability Distribution Function
  • Next by Date: Re: Importing data from the web
  • Previous by thread: Re: Importing data from the web
  • Next by thread: Re: Importing data from the web