Hyperlink to a file using python

MRAB python at mrabarnett.plus.com
Thu Oct 14 20:36:50 CEST 2010

On 14/10/2010 18:54, Pratik Khemka wrote:
> I think I did not frame the question in a proper manner..
> I want to open pratik.html which is there in the same folder as the
> python program. I do not want to specify the path like you can see below
> in the code (blue) *_c:\Documents_ and Settings\My Documents..*The
> reason for this is that I want the code to be portable , ie others
> should also be able to run the program on their computers in whichever
> folder they want to. In this situation the code wont work on other
> computers due to the path name specified.
> Currently I am using this code below :
> *sheet.write(4,3,"**file:///c:\Documents** and Settings\My
> Documents\pratik.html",hyperlink_style)*
> **
> What I want to know is that if there is a way to remove the blue part
> (path to file)..I think it should be possible because the /file is
> present in the same folder as the python program/..
> Currently the hyperlink only works if the blue part is also there..I am
> sorry if this question probably does not belong to this group and maybe
> belongs more to the excel group.
> Thanks a lot for all the help..I really aprreciate it..
Try a relative hyperlink like "file:pratik.html".

More information about the Python-list mailing list