Re: [Tutor] Help me out please

2016-07-20 Thread Danny Yoo
On Tue, Jul 19, 2016 at 4:31 AM, Marc Sànchez Quibus
 wrote:
> Hi,
> First of all I'm gonan introduce myself. My name is Marc and I'm a student
> and also a python's programmer begginer. I've been studying/learning python
> and now I need some help to finish my project.
> I have two scripts, one of them in python (the main script) and the other
> one written in html. Well, is just a brief javascript (an app) that I took
> by Github. I need to change a variable inside this html script. I was
> wondering wether I could change this variable from my python script or not.
> Is there some way to do it?

Hi Marc,

Yes.  You might want to read something like this to get some
background.  Phil Greenspun's Guide to Web Publishing:

http://philip.greenspun.com/panda/

Specifically, the chapter "Sites that are really progarms".

http://philip.greenspun.com/panda/server-programming

You mentioned that you have two scripts, one in Python and the other in HTML.

A web site can be seen as this: something that (1) takes in a web
request sent by a browser, and (2) spits out a web response.

A static web site takes in a web request, looks for an appropriate
file, and prints that file back as a web response.  But that's not the
only way we can build web responses.  A programmatic web site can take
that request and *generate* a web page on the fly.  A web site can
actually be a program: not just a plain text file.


There are a lot of resources to teach how to write programs that serve
web sites.  Another by the same author is
http://philip.greenspun.com/seia/, which goes into a lot more detail.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help me out please

2016-07-19 Thread Bob Gailer
On Jul 19, 2016 9:24 AM, "Marc Sànchez Quibus" 
wrote:
>
> Hi,
> First of all I'm gonan introduce myself. My name is Marc and I'm a student
> and also a python's programmer begginer. I've been studying/learning
python
> and now I need some help to finish my project.
> I have two scripts, one of them in python (the main script) and the other
> one written in html. Well, is just a brief javascript (an app) that I took
> by Github. I need to change a variable inside this html script. I was
> wondering wether I could change this variable from my python script or
not.
> Is there some way to do it?

There might be. Tell us more about your situation.

> Thanks in advance and sorry for the inconvenience.

Since we are here to help, the only inconvenience his when we don't get
enough information. That seems to be typical for first time questioners.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help me out please

2016-07-19 Thread Alan Gauld via Tutor
On 19/07/16 12:31, Marc Sànchez Quibus wrote:

> and now I need some help to finish my project.
> I have two scripts, one of them in python (the main script) and the other
> one written in html. Well, is just a brief javascript (an app) that I took
> by Github. I need to change a variable inside this html script. I was
> wondering wether I could change this variable from my python script or not.
> Is there some way to do it?

The easiest way is to put the entire html code into a string
inside a module:

# file: myhtml.py

html = """
Hello %s
"""

Then import that and use string formatting to insert the variable

#file: myscript.py
import myhtml
myvar = "World"
print myhtml.html % myvar

Instead of printing you could overwrite the original html file.

Or you could write a web based app using a framework like Flask
or Pylons and call your myscript.py from a web url and get it
to just serve the html string directly.

We don't know enough about your system and how the two
scripts are related to say more than that. But it might
give you some ideas.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Help me out please

2016-07-19 Thread Marc Sànchez Quibus
Hi,
First of all I'm gonan introduce myself. My name is Marc and I'm a student
and also a python's programmer begginer. I've been studying/learning python
and now I need some help to finish my project.
I have two scripts, one of them in python (the main script) and the other
one written in html. Well, is just a brief javascript (an app) that I took
by Github. I need to change a variable inside this html script. I was
wondering wether I could change this variable from my python script or not.
Is there some way to do it?
Thanks in advance and sorry for the inconvenience.

-- 
*Marc Sànchez Quibus*
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor