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?
Your_mum 0 Light Poster
Recommended Answers
Jump to PostNot really recommended, since you don't really always want to pause your code but I think you want this:
class Name: def __init__(self): self.name = raw_input("Name: ")
However, I'd have to agree that snippsat's solution is a better written class, because if neccessary you could use it …
All 4 Replies
Reply 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.