0

I am trying to create a dynamic page that has to do some work behind the scene/server side and also show a web page where the person can retrieve what we have processed server side. So just as a base template for a page I have this:

#!/usr/bin/python
import cgi, os, sys, commands

print "Content-type: text/html\n";

print "<html>\n"
print "<head>\n"
print "<title>My Title Here</title>\n"

#Need to find out how to get python to get css code done. 
print "<![if !IE]>  <link href="../styles/screen.css" rel="stylesheet" type="text/css" media="screen" /> <![endif]>\n"

print "</head>\n"
print "<body>\n"
print "<body>\n"
print "</html>\n"

This line print "<![if !IE]> <link href="../styles/screen.css" rel="stylesheet" type="text/css" media="screen" /> <![endif]>\n" Is the one causing problems. How does one use this logical way of finding out and using the css when the page is built in python then served to the user? How do I incorporate css in my pages when done through python?

2
  • You have to use single quotes ' around a string if the string contains double quotes ". Commented Dec 15, 2014 at 19:29
  • Note that only the first print statement requires the \n at the end (since the headers must be separated from the content by a blank line). The remainder will be perfectly OK with simply the \n that the print statement automatically adds. You could also look into using triple quotes, to allow you to more easily include quotes in your content. Commented Dec 15, 2014 at 19:50

1 Answer 1

1

You can try this:

print '<![if !IE]>  <link href="../styles/screen.css" rel="stylesheet" type="text/css" media="screen" /> <![endif]>\n'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.