Python Forum
How to write a code to get this kind of output in IDLE
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to write a code to get this kind of output in IDLE
#1
In IDLE I imported sympy.matrices module

for an example
I entered the following
>>> from sympy.matrices import Matrix
>>> a=Matrix([[1,2,3],[4,5,6],[7,8,9]])
>>> a
Matrix([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
and also I imported a custom library created by me.
this is a part of my module
class dog:
    def __init__(self,name,age,gender):
        self.name=name
        self.age=age
        self.gender=gender
In IDLE I entered following in the same as the previous
>>> from my_modules.dog import dog
>>> b=dog("sam",5,"male")
>>> b
<my_modules.dog.dog object at 0x00460950>
the problem is I entered codes in the same way. But the outputs are in the different forms

in first example it gave the following output instead of giving an output
just like <sympy.matrices.Matrix object at 0x00512950>
Output:
Matrix([ [1, 2, 3], [4, 5, 6], [7, 8, 9]])
I need to know how to code my custom module to return an output just like
>>>b
Dog('sam','5years','male')
instead of <my_modules.dog.dog object at 0x00460950>

can someone help Me please Pray Pray
Reply


Messages In This Thread
How to write a code to get this kind of output in IDLE - by kavindu - Oct-28-2018, 05:23 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  UART write binary code trix 3 371 Apr-28-2024, 04:57 PM
Last Post: deanhystad
  write code that resides in parent directory franklin97355 3 496 Apr-14-2024, 02:03 AM
Last Post: franklin97355
  Why can I not see the code correctly in Python IDLE.? Trump 8 827 Apr-04-2024, 07:47 AM
Last Post: jonesphedra
  problem in output of a snippet code akbarza 2 430 Feb-28-2024, 07:15 PM
Last Post: deanhystad
  needing some help to write some code for a game calculator rymdaksel 1 486 Jan-02-2024, 09:56 AM
Last Post: deanhystad
  Reading data from excel file –> process it >>then write to another excel output file Jennifer_Jone 0 1,160 Mar-14-2023, 07:59 PM
Last Post: Jennifer_Jone
  I cannot able to see output of this code ted 1 793 Feb-22-2023, 09:43 PM
Last Post: deanhystad
  What kind of list is this? jesse68 2 1,185 Jun-29-2022, 05:02 PM
Last Post: rob101
  why I dont get any output from this code William369 2 1,173 Jun-23-2022, 09:18 PM
Last Post: William369
  How can I organize my code according to output that I want ilknurg 1 1,210 Mar-11-2022, 09:24 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

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