Skip to main content

Posts

Showing posts with the label tutorialspot

how to pass one variable to other page or same page | JS | HTML

How to pass one variable to another page or same page?  So, Here I have given two file's code where one is data sending file. And another one is data receiving file if we transfer to another page. index.html <form action="#tp" method="get"> <input type="text" name="serialNumber" Value="rajnish" /> <input type="submit" value="Submit" /> </form> <div id="tp"> <div id="data"> </div> </div> <script> function processForm() { var parameters = location.search.substring(1).split("&"); var temp = parameters[0].split("="); l = unscape(temp[1]); document.getElementById("data").innerHTML = l; } processForm(); </script> Here above code will be used only when you want to pass a variable on one page only. <form action="#tp" method="get"> <i...

How to Writing into CSV File with Python Programming

how to write into a CSV file with a Python Programming? So, Here I have given Python Code and CSV file which I was used in Tutorial. Python Code: import csv with open("data.txt", "r") as dataFile: dataFileReader = csv.reader(dataFile) dataList = [] for row in dataFileReader: if len (row) != 0: dataList = dataList + [row] dataFile.close() print(dataList) name = input("Enter name: ") secondName = input("Enter secondName: ") value1 = input("value1: ") value2 = input("value2: ") value3 = input("value3: ") with open("data.txt", "a") as dataFile: dataFileWriter = csv.writer(dataFile) dataFileWriter.writerow([name, secondName, value1, value2, value3]) dataFile.close() CSV File : ABC, XYZ, 1, 2, 3 PQR, WXY, 4, 5, 6 DEF, JKL, 7, 8, 9 This Python code is made for a view, imports, and write the comma separated files in python app. Also with this code user can r...