Python Forum
How to Randomly Print a Quote From a Text File When User Types a Command on Main Menu
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Randomly Print a Quote From a Text File When User Types a Command on Main Menu
#11
I would start with the module as-is and just add the code from my example. See how long it takes to import. Python is pretty quick about loading modules. I've never had a 1.1 MB module, but I'm sure I regularly import modules that add up to more than that. Don't worry about 80 columns. That is for readabiliy, and nobody is going to read this code.

You can place import commands anywhere in your python code but people expect them at the top of the module. It makes them easy to find.

You can import the module anywhere you want to use it. After the module is imported the first time, subsequent imports reuse the same module object.
Reply


Messages In This Thread
RE: How to Randomly Print a Quote From a Text File When User Types a Command on Main Menu - by deanhystad - Apr-11-2024, 07:04 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Cannot get cmd to print Python file Schauster 11 385 Yesterday, 04:40 PM
Last Post: xMaxrayx
  problem with print command in super() akbarza 5 687 Feb-01-2024, 12:25 PM
Last Post: deanhystad
  pyaudio seems to randomly halt input. elpidiovaldez5 2 442 Jan-22-2024, 09:07 AM
Last Post: elpidiovaldez5
  Problem with code / audio is playing randomly, not matching csv requirements Daniel_kcr 2 687 Sep-07-2023, 05:09 PM
Last Post: deanhystad
  Start print a text after open an async task via button Nietzsche 0 741 May-15-2023, 06:52 AM
Last Post: Nietzsche
  Python VS Code: using print command twice but not getting output from terminal kdx264 4 1,169 Jan-16-2023, 07:38 PM
Last Post: Skaperen
Thumbs Up Need to compare the Excel file name with a directory text file. veeran1991 1 1,173 Dec-15-2022, 04:32 PM
Last Post: Larz60+
  python sql query single quote in a string mg24 1 1,129 Nov-18-2022, 08:01 PM
Last Post: deanhystad
  python run all py files from main py file mg24 6 1,447 Oct-12-2022, 04:41 AM
Last Post: mg24
  Saving the print result in a text file Calli 8 1,929 Sep-25-2022, 06:38 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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