Say I have a variable, 'New', who's value is Raw_input("Enter name: ") How could I take this variable and pass it into a class?
Jump to Post
You can pass value in as argument.
new = raw_input('Enter name: ') class Test(object): def __init__(self,value): self.value = value x = Test(new) print x.value ''' output--> Enter name: hi hi '''
All 4 RepliesReply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.