i want to show value that is retrieved from database and stored in variable to text field .<input type=text name="" value =""> i want to show value in it..what is the method to print in python script | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

i want to show value that is retrieved from database and stored in variable to text field .<input type=text name="" value =""> i want to show value in it..what is the method to print in python script

plzzzzzzzzzz help

2nd Jul 2016, 9:42 AM
swapnil Singh
swapnil Singh - avatar
7 Answers
0
print () If you wanted to know how to print the variable in the html string, you could just concatenate it. E.g print("value ="+str (variable)). Or you could use the format method which is print("value = {}".format (variable)). If your variable is already a string, you don't need to use the str function. The format method is more useful if you want to use multiple variables in a string. It is easier to type out than concatenating. E.g print ("Traveled {}metres in {} seconds.".format(distance, time)) You can also pass the variables as a tuple. E.g print ("value = %s" % (variable)). Hope this is what you were looking for.
2nd Jul 2016, 10:59 AM
Gershon Fosu
Gershon Fosu - avatar
0
but i am writing this code inside the python script using print (<input....and so on) how to write in this situation
2nd Jul 2016, 11:09 AM
swapnil Singh
swapnil Singh - avatar
0
actually i am making a edittable table using textfields.so i am able to send the data to database and when i try to retrieve the data i am not able to show in textfield how to do that ??
2nd Jul 2016, 11:12 AM
swapnil Singh
swapnil Singh - avatar
0
print ("<input type=\"text\" name=\"\" value={}".format(variable))
2nd Jul 2016, 11:34 AM
Gershon Fosu
Gershon Fosu - avatar
0
sir i try it but its not working my apache error log showing that syntax error
2nd Jul 2016, 12:05 PM
swapnil Singh
swapnil Singh - avatar
0
thanku gershon fosu its working..thanku man
2nd Jul 2016, 12:11 PM
swapnil Singh
swapnil Singh - avatar
0
Glad I could help
2nd Jul 2016, 12:15 PM
Gershon Fosu
Gershon Fosu - avatar