Feb-03-2020, 10:23 PM
(This post was last modified: Feb-03-2020, 10:23 PM by JonnyDriller.)
All I'm trying to do here is give the variable more scope without using the global function.
Sorry guys I thought I could solve this. At first I just did as you asked Michael. Removed the 2 function calls and placed the function inside the other. As I mentioned - this caused it to print:
So I removed the "return"
And I got
After a series of attempts my last one is below
This weirdly prints
It's as if the things looping inside itself. Which I'm sure might be a useful trait at some point. But not with this
Lastly I tried to switch the functions
Sorry guys I thought I could solve this. At first I just did as you asked Michael. Removed the 2 function calls and placed the function inside the other. As I mentioned - this caused it to print:
Quote:Mylocation
Mylocation
So I removed the "return"
And I got
Quote:Mylocation
None
After a series of attempts my last one is below
This weirdly prints
Quote:MylocationfooI though it would print
Mylocationfoo
Quote:Mylocationfoo
Mylocation
I thought only the second one was going to have the foo def dataread(): test_file = open('Database.txt', 'r') test_lines = test_file.readlines() test_file.close() #Print line liner = (test_lines[1]) colon = liner.find(":") semi = liner.find(";") comma = liner.find(",") length = len(liner) name = (liner[colon+1:semi]) location = (liner[semi+1:comma]) gps = (liner[comma+1:length]) htmlwr(location) return location def htmlwr(location): Tester = location + "foo" print(tester) htmlwr(dataeread())If I remove the "return value" from this one it prints
Quote:Mylocationfoo
Error
It's as if the things looping inside itself. Which I'm sure might be a useful trait at some point. But not with this
Lastly I tried to switch the functions
dataeread(htmlwr())But it gave me a position error