3
votes
1answer
46 views

Clean up repeated file.writes, if/elses when adding keys to a dict

I'm getting familiar with python and I'm still learning it's tricks and idioms. Is there an better way to implement print_html() without the multiple calls to ...
5
votes
0answers
97 views

How can I make my website have a more modern look? [closed]

After looking at my site, I've been told by my bud: You know what this looks like? The nineties. I think it looks alright, maybe a little old fashioned but I've been staring at it so long now ...
5
votes
2answers
81 views

First program with scraping, lists, string manipulation

I wanted to find out which states and cities the USA hockey team was from, but I didn't want to manually count from the roster site here. I'm really interested to see if someone has a more elegant ...
2
votes
1answer
78 views

Create HTML listing of source code

This is a Python script I made to create a HTML page listing the source files in the current directory. The script creates a syntax highlighted preview of the files and lists some basic attributes. ...
2
votes
1answer
25 views

Handling objects and arrays simply in this tagging library

I have written this little tagging module to make it easier to generate small html snippets on the fly. The examples below show how this make things a bit easier. My question is about the handling of ...
6
votes
2answers
267 views

Generating random HTML color grid

This is a Python script that generates a grid of random HTML colors. It works by reading random data from /dev/urandom and then encoding it as a hexadecimal ...
5
votes
1answer
292 views

adding a new class to html tag and writing it back with beautifulsoup

I am working on a HTML document to which I need to add certain classes to some elements. In following code I am adding class 'img-responsive'. Here is my code : ...
2
votes
2answers
762 views

Removing extra spaces in beautiful soup code and other improvements

I have written a script using Beautiful Soup to scrape some HTML and do some stuff and produce HTML back. However, I am not convinced with my code and I am looking for some improvements. Following is ...
3
votes
2answers
167 views

Simplification of Python code (HTML extraction)

I'd like to extract HTML content of websites and save it into a file. To achieve this, I have the following (working) code: ...
2
votes
3answers
70 views

Building and getting a form of objects that have multiple properties

I'm building a form dynamically in a web app where I'm using product_id to keep track which product I'm reading and then ...
0
votes
1answer
78 views

How would you improve this point of interaction between Python and Javascript?

I'm writing a checkout form for purchasing online tests. You can buy a certification or a recertification, as well as a pdf or book study manual. I'm using Jinja2 templates to provide test data into ...