I have written multiple functions that when I call them directly, they result as expected. This is the function:
def number_generator():
for number in range(1, 815+1):
file = open('numbers.txt', 'a')
file.write(f'{number}\n')
file.close()
It writes numbers from 1 to 815 without problem.
But when I call this function inside another function, it returns unexpected value. This is the other function:
def test():
file1 = open('file1.txt', 'a')
file1.write(f'{query_generator()}{number_generator()}\'\n')
file1.close()
The current result is NoneNone'.
query_generator generates 815 times one SQL query in 815 lines, and number_generator generates number for ID of each my website products.
But when I use them inside test function I do not get the expected value.
What I did so far is I removed the lines related to file variable related to number_generator and query_generator, and added a return statement inside both of them but that did not work.
My expected value is like something below:
UPDATE `tblpricing` SET `msetupfee` = '1'
UPDATE `tblpricing` SET `msetupfee` = '2'
UPDATE `tblpricing` SET `msetupfee` = '3'
How may I reach it?