The below python function prints value using print function but is returning none if made to return string value. can anyone help me on how to return a string value from this below function.
csv_full_list = ['mycsv_0', 'mycsv_1']
def create_csv_name(comm, index):
global csv_full_list
if comm + '_' + str(index) in csv_full_list:
index += 1 # increment index by 1
create_csv_name(comm, index=index)
else:
print '%s_%i' % (comm, index)
return '%s_%i' % (comm, index)
print(create_csv_name('mycsv', 0))
out put expected :
mycsv_2
but returns:
None