Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code printing twice
#3
what is the name of the first program.
Too many things named database, makes it confusing.
this code in giveaway.py will always run.
# If a giveaway is saved in memory, load it automaticly
db = database.database()
db.init()
print(db.data["userdata"]["help"])
if you only want this to run if the program is executed from command routine, change to:
if __name__ == '__main__':
            # If a giveaway is saved in memory, load it automaticly
    db = database.database()
    db.init()
    print(db.data["userdata"]["help"])
some other items, indentation should be 4.
set is a bad name for a method as it as a python command.
you should add an empty line between methods to make code more readable.
Reply


Messages In This Thread
Code printing twice - by hypersdevelopment - Sep-08-2018, 10:48 PM
RE: Code printing twice - by ichabod801 - Sep-08-2018, 11:32 PM
RE: Code printing twice - by Larz60+ - Sep-08-2018, 11:45 PM
RE: Code printing twice - by hypersdevelopment - Sep-09-2018, 12:06 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  I'm not sure why this code isn't printing... Can someone tell me? Wilminer4 5 3,762 Mar-01-2018, 06:58 PM
Last Post: Wilminer4

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020