Help with language, dev tool selection
I have a problem that I have to solve programmatically and since HTML is pretty much the only code I have been exposed to I need an advice on how to develop the programmatic solution to the problem I have. In the nutshell, it'd be great if you can give me guidance in terms of: 1) What programming language to use 2) What development tools to use 3) Tips on how to code the solution So, here is my challenge: I have a flat text file, 3 records, each record has two columns, the columns are tab separated. The file looks like this (approximately) Sarajevo431104-133111 Mostar 441242-133421 Zagreb 432322-134423 The first value is a name of a town, and the second value represent longitude-latitude in degrees, minutes and seconds. For each record I have to create an html file that will be named as the name of the town (i.e. Sarajevo.html). The content of the file will be rather simple; in the first row it will contain the header (i.e. "This page displays longitude-latitude information") - The second row will have the following word: "Grad" - and the third row will contain the name of the city and the fourth row will have the longitude-latitude info. The program also needs to prompt me (before it starts spitting the html pages) and ask what test should be entered in line one (I would than manually enter "This page displays longitude-latitude information") and it also need to prompt me about the text that should be entered in line two (I'd go and manually enter "grad"). I'd greatly appreciate any coment and/or guidance. Best, Vasilije Petkovic Vasa -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with language, dev tool selection
Further clarification: The pages will have to be pure static html pages (so no datasource will be driving generation of the pages). Therefore, I'd have to create 30,000 files. It's my understanding that almost every host should be able to serve a simple and static html code. Best, Vasa -- http://mail.python.org/mailman/listinfo/python-list
Looping Problem (Generating files - only the last record generates a file)
Hello All, I have a problem with the program that should generate x number of txt files (x is the number of records in the file datafile.txt). Once I execute the program (see below) only one file (instead of x files) is created. The file created is based on the last record in datafile.txt. The program is as follows: #! python HEADER = "This page displays longitude-latitude information" SUBHEADER = "City" for line in open("datafile.txt"): town, latlong = line.split('\t') f = open(town + ".txt", "w+") f.write(HEADER + "\n") f.write(SUBHEADER + ": " + town + "\n") f.write("LAT/LONG" + ": " + latlong + "\n") f.close() # end The datafile.txt is as follows (tab separated columns): NYC - Lima- Rome- Once executed, the program will create a single file (named Rome.txt) and it would not create files NYC.txt and Lima.txt as I would expect it to do. I'd appreciate if you can pinpoint my error. Best, Vasa -- http://mail.python.org/mailman/listinfo/python-list
Re: Looping Problem (Generating files - only the last record generates a file)
Guys - This fixed the issue - thanks to all -- http://mail.python.org/mailman/listinfo/python-list