Message Boards Message Boards

3 Replies
0 Total Likes
View groups...
Share this post:

How do I Export[] hyperlinks that I've gotten from an Import[]?

Posted 10 years ago
In a Mathematica notebook, I enter and evaluation the following code, :   url = ""
fileName = "C:\Projects\Wolfram\AlphabeticalListing.txt"
links = Import[url, "Hyperlinks"]
lEx = Export[fileName, links]

The following is a partial example of what I get for output from the "links=" line above:

{"", "",
"", "",

A partial example of the output in the text file for the "lEx=" line above is:

{" Index of All New Functions ", {{"AbelianGroup", "AllowedDimensions", "Arg"}, {"Abort", "AllowGroupClose", "ArgMax"}, {"AbortKernels", "AllowReverseGroupClose", "ArgMin"}, {"AbortProtect", "AlphaChannel", "ARIMAProcess"},

Obviously, the two are not the same.  How do I output to a text file, these hyperlinks from the Import[] line?
POSTED BY: Baruch Bashan
3 Replies

I just checked and it seems to work fine for me (V 10.2 Mac OSX). I also just fixed the unintended carriage return in (this is the correct version)

url = ""

in my original post.

Perhaps a Wolfram person in this list can check whether there is a Windows vs Mac issue at play here.

POSTED BY: David Reiss
Posted 9 years ago

David, I entered your code in v10.2 (Windows 8.1) and got the same result as Baruch.

POSTED BY: Bruce Colletti
What version of Mathematica are you using?    Your code works fine for me...
 In[9]:= url = ""
 Out[9]= ""
 In[10]:= fileName = "/Users/dreiss/Desktop/AlphabeticalListing.txt"
Out[10]= "/Users/dreiss/Desktop/AlphabeticalListing.txt"

In[11]:= links = Import[url, "Hyperlinks"];

In[12]:= lEx = Export[fileName, links]

Out[12]= "/Users/dreiss/Desktop/AlphabeticalListing.txt"

In[13]:= FilePrint[%]

(* truncating the output here...  *)

If you are using an earlier version of Mathematica than 9 and it's having a hard time figuring out the export format, you might want to be more explicit by using 
lEx = Export[fileName, links, "Lines"]

But what you are getting suggests to me that  you had actually executed 
links = Import[url, "Data"]
which would give the result that you got.

I hope this helps....
POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract